@morphllm/morphmcp 0.8.171 → 0.8.173

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_0x5f4091=a0_0x2d0d;(function(_0x486795,_0x3d5828){const _0x465fbb=a0_0x2d0d,_0x527f6a=_0x486795();while(!![]){try{const _0x3a911e=-parseInt(_0x465fbb(0x1c6))/0x1+-parseInt(_0x465fbb(0x1a5))/0x2*(-parseInt(_0x465fbb(0x205))/0x3)+-parseInt(_0x465fbb(0x1d1))/0x4*(parseInt(_0x465fbb(0x227))/0x5)+parseInt(_0x465fbb(0x22c))/0x6*(parseInt(_0x465fbb(0x1e2))/0x7)+parseInt(_0x465fbb(0x20d))/0x8+-parseInt(_0x465fbb(0x214))/0x9*(parseInt(_0x465fbb(0x266))/0xa)+parseInt(_0x465fbb(0x27f))/0xb;if(_0x3a911e===_0x3d5828)break;else _0x527f6a['push'](_0x527f6a['shift']());}catch(_0x1a2007){_0x527f6a['push'](_0x527f6a['shift']());}}}(a0_0x464c,0xeee94));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_0x13de7e from'fs/promises';import a0_0x2c51d4 from'path';import a0_0x4b581a 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_0x355914 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x44b625){const _0x252451=a0_0x2d0d,_0x26748b=_0x44b625[_0x252451(0x1df)](a0_0x2c51d4[_0x252451(0x249)])[_0x252451(0x1be)](Boolean);if(_0x26748b['length']<0x2)return null;for(let _0x259020=Math[_0x252451(0x24b)](_0x26748b[_0x252451(0x1e8)]/0x2);_0x259020>=0x1;_0x259020--){for(let _0x8b67f4=0x0;_0x8b67f4<=_0x26748b[_0x252451(0x1e8)]-0x2*_0x259020;_0x8b67f4++){const _0x21dd2a=_0x26748b['slice'](_0x8b67f4,_0x8b67f4+_0x259020),_0x48581d=_0x26748b[_0x252451(0x19a)](_0x8b67f4+_0x259020,_0x8b67f4+0x2*_0x259020);if(_0x21dd2a[_0x252451(0x1a1)]((_0x5ec4b8,_0x11abe5)=>_0x5ec4b8===_0x48581d[_0x11abe5])){const _0x29b4b1=[..._0x26748b[_0x252451(0x19a)](0x0,_0x8b67f4),..._0x26748b[_0x252451(0x19a)](_0x8b67f4+_0x259020)];return a0_0x2c51d4[_0x252451(0x249)]+_0x29b4b1[_0x252451(0x208)](a0_0x2c51d4[_0x252451(0x249)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x72af9b=a0_0x2d0d;try{const _0x4bf860=require(_0x72af9b(0x19c));return _0x4bf860[_0x72af9b(0x245)]??_0x72af9b(0x1d9);}catch(_0x5236b1){return logMcpStderr(_0x72af9b(0x1d5),_0x5236b1),'unknown';}}function printHelp(){const _0x1420be=a0_0x2d0d;console[_0x1420be(0x1e9)](_0x1420be(0x239)+getPackageVersion()),console[_0x1420be(0x1e9)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console['log'](_0x1420be(0x23a)),console[_0x1420be(0x1e9)](_0x1420be(0x1b5)),console[_0x1420be(0x1e9)](_0x1420be(0x199)),console[_0x1420be(0x1e9)](_0x1420be(0x18a)),console[_0x1420be(0x1e9)](_0x1420be(0x256)),console[_0x1420be(0x1e9)]('\x20\x20morph-mcp'),console[_0x1420be(0x1e9)](_0x1420be(0x264));}const cliArgs=process[a0_0x5f4091(0x291)][a0_0x5f4091(0x19a)](0x2),VERSION_FLAGS=new Set([a0_0x5f4091(0x275),'-v','-V']),HELP_FLAGS=new Set([a0_0x5f4091(0x297),'-h']);cliArgs[a0_0x5f4091(0x213)](_0x2558b5=>VERSION_FLAGS[a0_0x5f4091(0x27d)](_0x2558b5))&&(console[a0_0x5f4091(0x1e9)](a0_0x5f4091(0x239)+getPackageVersion()),process[a0_0x5f4091(0x278)](0x0));cliArgs[a0_0x5f4091(0x213)](_0x3aa8e1=>HELP_FLAGS[a0_0x5f4091(0x27d)](_0x3aa8e1))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x352b5c){const _0x4df7a3=a0_0x5f4091;for(let _0x23950e=0x0;_0x23950e<cliArgs['length'];_0x23950e++){const _0x1d896e=cliArgs[_0x23950e];if(_0x1d896e['startsWith']('--'+_0x352b5c+'='))return _0x1d896e[_0x4df7a3(0x19a)](('--'+_0x352b5c+'=')[_0x4df7a3(0x1e8)]);if(_0x1d896e==='--'+_0x352b5c&&_0x23950e+0x1<cliArgs[_0x4df7a3(0x1e8)])return cliArgs[_0x23950e+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x5f4091(0x27d)](arg)||HELP_FLAGS[a0_0x5f4091(0x27d)](arg))continue;if(arg[a0_0x5f4091(0x29a)](a0_0x5f4091(0x1ca)))continue;if(arg===a0_0x5f4091(0x26e)){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process['env']['WORKSPACE_ROOT']||process[a0_0x5f4091(0x1f6)][a0_0x5f4091(0x1a4)]||process[a0_0x5f4091(0x25d)](),ENABLE_WORKSPACE_MODE=process[a0_0x5f4091(0x1f6)][a0_0x5f4091(0x207)]!==a0_0x5f4091(0x1c3),MORPH_API_KEY=getCliArg(a0_0x5f4091(0x254))??process['env'][a0_0x5f4091(0x175)],MORPH_API_URL=process['env'][a0_0x5f4091(0x28a)],MORPH_LARGE_APPLY=process[a0_0x5f4091(0x1f6)][a0_0x5f4091(0x1ae)]!==a0_0x5f4091(0x1c3),MORPH_WARP_GREP_TIMEOUT=process[a0_0x5f4091(0x1f6)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x5f4091(0x1f6)][a0_0x5f4091(0x27e)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process['env'][a0_0x5f4091(0x1e1)]?new Set(process[a0_0x5f4091(0x1f6)]['DISABLED_TOOLS'][a0_0x5f4091(0x1df)](',')[a0_0x5f4091(0x1a2)](_0x2f9bd7=>_0x2f9bd7[a0_0x5f4091(0x1b2)]())[a0_0x5f4091(0x1be)](_0x46a25b=>_0x46a25b[a0_0x5f4091(0x1e8)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x5f4091(0x243)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x5f4091(0x27d)](tool)&&console['error'](a0_0x5f4091(0x295)+tool+a0_0x5f4091(0x250)+[...KNOWN_TOOL_NAMES][a0_0x5f4091(0x208)](',\x20'));}console[a0_0x5f4091(0x21f)](a0_0x5f4091(0x1fa)+[...DISABLED_TOOLS][a0_0x5f4091(0x208)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x5f4091(0x1dc))&&!MORPH_API_KEY[a0_0x5f4091(0x29a)](a0_0x5f4091(0x178))&&logMcpStderr('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0xeafcb2){const _0x54d8c2=a0_0x5f4091;try{await a0_0x355914['post'](_0x54d8c2(0x262),{..._0xeafcb2,'timestamp':new Date()[_0x54d8c2(0x265)](),'source':_0xeafcb2[_0x54d8c2(0x1a8)]||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0xeafcb2['context']}},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x54d8c2(0x1b7)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x299006,_0x3bf5e7){const _0x4fa834=a0_0x5f4091;if(_0x299006&&typeof _0x299006==='object'&&'status'in _0x299006)return _0x299006[_0x4fa834(0x267)];if(_0x299006&&typeof _0x299006===_0x4fa834(0x198)&&'response'in _0x299006)return _0x299006[_0x4fa834(0x194)]?.[_0x4fa834(0x267)];const _0x37d52c=_0x3bf5e7[_0x4fa834(0x1a3)](/\b(401|429)\b/);return _0x37d52c?parseInt(_0x37d52c[0x1],0xa):null;}function a0_0x2d0d(_0xc335df,_0x5b269f){_0xc335df=_0xc335df-0x16b;const _0x464c51=a0_0x464c();let _0x2d0dc6=_0x464c51[_0xc335df];return _0x2d0dc6;}function a0_0x464c(){const _0x49a4f6=['Morph\x20Edit\x20Preview','ENABLE_WORKSPACE_MODE','join','list_directory','Error\x20accessing\x20directory\x20','Tool\x20','BinaryFile','822704pNckoo','\x0a</file>','linesRemoved','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','connect','codebase_search','some','16939107opiHkR','code_edit','morph-v3-fast','Workspace\x20mode\x20enabled:\x20Using\x20','api_request_start','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','Rules:\x0a','\x20chars)','Warning:\x20','error','assistant','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','github_url','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','homedir','string','SymlinkError','10oOVJlu','requiresApiKey','finish','pattern','\x20(new\x20file)','1052478PapHnt','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','\x20error(s)','setNotificationHandler','morph-v3-large','metadata','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','added\x20','data','MCP','mcp-filesystem','read','setRequestHandler','@morphllm/morphmcp\x20','\x0aOptions:','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','Morph\x20Edit\x20','completed_with_file_errors','repo_path','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','safeParse','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','search_string','size','timeout','version','warp_grep_complete','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','realpath','sep','Unknown\x20error','floor','\x22>\x0a','github_search_start','name','branch','\x22.\x20Known\x20tools:\x20','constructor','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','role','api-key','timed\x20out','\x0aExamples:','files','errors','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','tool_call_error','\x27\x20in\x20`','code','cwd','path_validation_start','ReadError','text','API\x20error\x20(auth/rate-limit)','https://morphllm.com/api/error-report','readFile','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','toISOString','10ImrwSi','status','FileNotFound','.\x20Path:\x20','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','arguments','Max\x20results\x20to\x20return','node_modules','--api-key','morph-mcp','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','Unknown\x20tool:\x20','stack','--version','Benefits:\x0a','utf-8','exit','TimeoutError','content','params','stringify','has','MORPH_WARP_GREP_TIMEOUT','33854260WuQUeO','instructions','.vscode','Morph\x20FastApply\x20failed\x20without\x20error\x20message','warn','substring','GITHUB_CODEBASE_SEARCH','LocalRipgrepProvider','timings','Relevant\x20context\x20found:','<file\x20path=\x22','MORPH_API_URL','tool','Invalid\x20arguments:\x20','instruction','SubToolError','isArray','Parent\x20directory\x20does\x20not\x20exist:\x20','argv','catch','file_read_complete','dryRun','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','Specific\x20commit\x20hash\x20to\x20search','--help','push','grep_search','startsWith','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','indexOf','UnknownError','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','ENOENT','etimedout','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','number','read\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','MORPH_API_KEY','Here\x20is\x20the\x20content\x20of\x20files:\x0a','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','morph-','path','ms:','now','toLowerCase','edit_file','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','.cursor','ms.\x20Success:\x20','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','terminationReason','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','Error\x20running\x20fast\x20context\x20search:\x20','boolean','WarpGrep\x20sub-tool\x20errors:\x20','tool_calls','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','default','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','describe','Preview\x20changes\x20without\x20applying\x20them.','lines','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','Created\x20File','EDIT_FILE','-\x20Listed\x20directory\x20`','response','tsconfig.json','getClientCapabilities','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','object','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','slice','grep','../package.json','[github_codebase_search]\x20Failed\x20in\x20','payload','listRoots','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','every','map','match','PWD','2Gmkpsj','messages','glob','source','CODEBASE_SEARCH','access','github_codebase_search','\x20is\x20not\x20a\x20directory','-\x20Read\x20file\x20`','MORPH_LARGE_APPLY','\x20-\x20','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','trim','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','[could\x20not\x20read\x20file:\x20','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','GitHub\x20search\x20failed:\x20','Bearer\x20','description','debug','searchGitHub','completionId','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','RipgrepNotAvailable','filter','success','\x22>\x0aError\x20reading\x20file:\x20','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','resolve','false','Warning:\x20Workspace\x20fallback\x20failed:\x20','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','1330537GMCCUi','user','inputSchema','linesModified','--api-key=','Repository\x20identifier','all','turns','dirname','function','\x20valid\x20directories','3299404qfZJgF','compaction_failed','Fatal\x20error\x20running\x20server:','basename','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','normalize','Cargo.toml','unknown','\x0a...\x20(truncated,\x20total:\x20','oninitialized','sk-','tool_call_received','includes','split','Error:\x20','DISABLED_TOOLS','49vTxXVx','grep\x20\x27','tool_call_complete','\x20as\x20allowed\x20directory','optional','glob\x20\x27','length','log','-\x20Glob\x20search\x20`',',\x20removed\x20','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','message','target_file','path_validation_failed','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','command','isDirectory','morph-warp-grep-v2.1','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.','env','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.','stat','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','Disabled\x20tools:\x20','tool_call_id','0.2.0','.\x20Changes:\x20','package.json',',\x20modified\x20','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','Failed\x20to\x20request\x20roots\x20from\x20client:','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','roots','runWarpGrep_call','4297659gaLgBx'];a0_0x464c=function(){return _0x49a4f6;};return a0_0x464c();}function handleMorphAPIError(_0x1f8fac){const _0x51a8fb=a0_0x5f4091,_0x537901=_0x1f8fac instanceof Error?_0x1f8fac['message']:String(_0x1f8fac),_0xcde5ae=extractStatusCode(_0x1f8fac,_0x537901);switch(_0xcde5ae){case 0x191:return{'content':[{'type':_0x51a8fb(0x260),'text':'Authentication\x20failed:\x20Your\x20Morph\x20API\x20key\x20is\x20invalid\x20or\x20has\x20been\x20revoked.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key,\x20then\x20update\x20your\x20MCP\x20configuration.'}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x51a8fb(0x260),'text':_0x51a8fb(0x17e)}],'isError':!![]};default:return null;}}args[a0_0x5f4091(0x1e8)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x5f4091(0x184)),logMcpStderr(a0_0x5f4091(0x170)),logMcpStderr(a0_0x5f4091(0x1b3)),logMcpStderr(a0_0x5f4091(0x1b1)),logMcpStderr(a0_0x5f4091(0x16f)),logMcpStderr(a0_0x5f4091(0x1bc)));function normalizePath(_0x4e5c9e){const _0x4334b1=a0_0x5f4091;return a0_0x2c51d4[_0x4334b1(0x1d7)](_0x4e5c9e);}function expandHome(_0x385665){const _0x6a7fbe=a0_0x5f4091;if(_0x385665[_0x6a7fbe(0x29a)]('~/')||_0x385665==='~')return a0_0x2c51d4['join'](a0_0x4b581a[_0x6a7fbe(0x224)](),_0x385665[_0x6a7fbe(0x19a)](0x1));return _0x385665;}let allowedDirectories=await Promise[a0_0x5f4091(0x1cc)](args[a0_0x5f4091(0x1a2)](async _0xfc116a=>{const _0x5a007b=a0_0x5f4091,_0xfcee73=expandHome(_0xfc116a),_0x1ffe4b=a0_0x2c51d4[_0x5a007b(0x1c2)](_0xfcee73);try{const _0x721163=await a0_0x13de7e[_0x5a007b(0x248)](_0x1ffe4b);return normalizePath(_0x721163);}catch(_0x28a755){return normalizePath(_0x1ffe4b);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x5f4091(0x1e8)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr(a0_0x5f4091(0x217)+workspaceDir+a0_0x5f4091(0x1e5)));}catch(a0_0x48675a){logMcpStderr(a0_0x5f4091(0x22d)+a0_0x48675a);}async function detectWorkspaceRoot(_0x48f6b3){const _0x38b95b=a0_0x5f4091;let _0x2e81cc=a0_0x2c51d4[_0x38b95b(0x1c2)](_0x48f6b3);const _0x8c840e=['.git',_0x38b95b(0x281),_0x38b95b(0x1fe),_0x38b95b(0x1d8),'pyproject.toml','go.mod',_0x38b95b(0x180),_0x38b95b(0x195),'composer.json'];while(_0x2e81cc!==a0_0x2c51d4['dirname'](_0x2e81cc)){for(const _0x178a25 of _0x8c840e){const _0x16e9a1=a0_0x2c51d4[_0x38b95b(0x208)](_0x2e81cc,_0x178a25);try{return await a0_0x13de7e[_0x38b95b(0x1aa)](_0x16e9a1),normalizePath(_0x2e81cc);}catch{}}_0x2e81cc=a0_0x2c51d4[_0x38b95b(0x1ce)](_0x2e81cc);}return normalizePath(_0x48f6b3);}await Promise[a0_0x5f4091(0x1cc)](args[a0_0x5f4091(0x1a2)](async _0xced01c=>{const _0xac7705=a0_0x5f4091;try{const _0x1f35f8=await a0_0x13de7e[_0xac7705(0x1f8)](expandHome(_0xced01c));!_0x1f35f8[_0xac7705(0x1f3)]()&&(logMcpStderr(_0xac7705(0x1e0)+_0xced01c+_0xac7705(0x1ac)),process['exit'](0x1));}catch(_0x54db05){logMcpStderr(_0xac7705(0x20a)+_0xced01c+':',_0x54db05),process[_0xac7705(0x278)](0x1);}}));async function validatePath(_0x2de1cf){const _0x25699c=a0_0x5f4091,_0x55d623=expandHome(_0x2de1cf),_0xfd99eb=a0_0x2c51d4['resolve'](_0x55d623);logger[_0x25699c(0x1b9)](_0x25699c(0x235),_0x25699c(0x25e),{'raw_path':_0x2de1cf,'absolute':_0xfd99eb});try{const _0x35265f=await a0_0x13de7e[_0x25699c(0x248)](_0xfd99eb);return logger[_0x25699c(0x1b9)](_0x25699c(0x235),'path_validation_resolved',{'resolved':_0x35265f,'symlink':_0x35265f!==_0xfd99eb}),_0x35265f;}catch(_0x2946ff){if(_0x2946ff[_0x25699c(0x25c)]===_0x25699c(0x16d)){const _0x27e37f=a0_0x2c51d4['dirname'](_0xfd99eb);try{const _0x506e3f=await a0_0x13de7e[_0x25699c(0x248)](_0x27e37f),_0x4e7f96=a0_0x2c51d4[_0x25699c(0x208)](_0x506e3f,a0_0x2c51d4[_0x25699c(0x1d4)](_0xfd99eb));return logger[_0x25699c(0x1b9)](_0x25699c(0x235),'path_validation_resolved',{'resolved':_0x4e7f96,'new_file':!![]}),_0x4e7f96;}catch{logger[_0x25699c(0x21f)](_0x25699c(0x235),_0x25699c(0x1ef),{'raw_path':_0x2de1cf,'error':_0x25699c(0x290)+_0x27e37f});throw new Error(_0x25699c(0x290)+_0x27e37f);}}logger[_0x25699c(0x21f)](_0x25699c(0x235),_0x25699c(0x1ef),{'raw_path':_0x2de1cf,'error':_0x2946ff[_0x25699c(0x1ed)]});throw _0x2946ff;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x5f4091(0x225)](),'code_edit':z[a0_0x5f4091(0x225)]()[a0_0x5f4091(0x18d)](a0_0x5f4091(0x177)),'instruction':z[a0_0x5f4091(0x225)]()[a0_0x5f4091(0x18d)](a0_0x5f4091(0x23f)),'dryRun':z[a0_0x5f4091(0x187)]()[a0_0x5f4091(0x18b)](![])['describe'](a0_0x5f4091(0x18e))}),CODEBASE_SEARCH_QUERY_DESCRIPTION='Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.',WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x5f4091(0x225)]()[a0_0x5f4091(0x18d)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x5f4091(0x225)]()['describe'](a0_0x5f4091(0x259)),'search_type':z['enum'](['default',a0_0x5f4091(0x26d)])['optional']()[a0_0x5f4091(0x18d)](a0_0x5f4091(0x202))}),WarpGrepGitHubArgsSchema=z[a0_0x5f4091(0x198)]({'search_string':z[a0_0x5f4091(0x225)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x5f4091(0x225)]()[a0_0x5f4091(0x1e6)]()[a0_0x5f4091(0x18d)]('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_0x5f4091(0x225)]()[a0_0x5f4091(0x1e6)]()[a0_0x5f4091(0x18d)](a0_0x5f4091(0x16c)),'branch':z[a0_0x5f4091(0x225)]()[a0_0x5f4091(0x1e6)]()[a0_0x5f4091(0x18d)](a0_0x5f4091(0x210))}),CodebaseSearchArgsSchema=z['object']({'query':z['string']()[a0_0x5f4091(0x18d)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()[a0_0x5f4091(0x18d)](a0_0x5f4091(0x1cb)),'branch':z[a0_0x5f4091(0x225)]()[a0_0x5f4091(0x1e6)]()[a0_0x5f4091(0x18d)](a0_0x5f4091(0x1c1)),'commitHash':z[a0_0x5f4091(0x225)]()[a0_0x5f4091(0x1e6)]()['describe'](a0_0x5f4091(0x296)),'targetDirectories':z['array'](z['string']())[a0_0x5f4091(0x18b)]([])['describe'](a0_0x5f4091(0x17f)),'limit':z[a0_0x5f4091(0x171)]()[a0_0x5f4091(0x1e6)]()['default'](0xa)[a0_0x5f4091(0x18d)](a0_0x5f4091(0x26c))}),server=new Server({'name':a0_0x5f4091(0x26f),'version':a0_0x5f4091(0x1fc)},{'capabilities':{'tools':{}}});server[a0_0x5f4091(0x238)](ListToolsRequestSchema,async()=>{const _0x3a5348=a0_0x5f4091,_0x18d415=[{'name':TOOL_NAMES[_0x3a5348(0x192)],'description':_0x3a5348(0x219)+_0x3a5348(0x271)+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+'IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a'+_0x3a5348(0x276)+_0x3a5348(0x1ec)+_0x3a5348(0x1a0)+'-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a'+_0x3a5348(0x272)+_0x3a5348(0x21a)+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+_0x3a5348(0x1b0)+'For\x20deletions:\x0a'+_0x3a5348(0x221)+_0x3a5348(0x1d6)+_0x3a5348(0x21c)+_0x3a5348(0x174)+_0x3a5348(0x241)+_0x3a5348(0x1f9)+_0x3a5348(0x29b)+_0x3a5348(0x232)+_0x3a5348(0x197)+_0x3a5348(0x247),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x3a5348(0x1a9)],'description':_0x3a5348(0x223)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x3a5348(0x1c5)+_0x3a5348(0x18c)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x4c936e=_0x18d415[_0x3a5348(0x1be)](_0x3ae2a9=>{const _0x172815=_0x3a5348;if(DISABLED_TOOLS[_0x172815(0x27d)](_0x3ae2a9[_0x172815(0x24e)]))return console[_0x172815(0x21f)](_0x172815(0x20b)+_0x3ae2a9[_0x172815(0x24e)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0x172815(0x228)in _0x3ae2a9&&_0x3ae2a9[_0x172815(0x228)]&&!MORPH_API_KEY)return logMcpStderr(_0x172815(0x21e)+_0x3ae2a9[_0x172815(0x24e)]+_0x172815(0x26a)),![];return!![];});return{'tools':_0x4c936e['map'](_0x5a2c98=>({'name':_0x5a2c98[_0x3a5348(0x24e)],'description':_0x5a2c98[_0x3a5348(0x1b8)],'inputSchema':_0x5a2c98[_0x3a5348(0x1c8)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x1550b0=>{const _0x193030=a0_0x5f4091,{name:_0x47308c,arguments:_0x1a046d}=_0x1550b0[_0x193030(0x27b)],_0x43ba5c=Date[_0x193030(0x17b)]();logger[_0x193030(0x1b9)](_0x193030(0x235),_0x193030(0x1dd),{'tool':_0x47308c,'args':_0x47308c===_0x193030(0x17d)?{'path':_0x1a046d?.[_0x193030(0x179)],'instruction':_0x1a046d?.[_0x193030(0x28d)]||_0x1a046d?.[_0x193030(0x280)],'dryRun':_0x1a046d?.[_0x193030(0x294)]}:_0x1a046d});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x193030(0x260),'text':_0x193030(0x270)}],'isError':!![]};if(!MORPH_API_KEY[_0x193030(0x29a)]('sk-')&&!MORPH_API_KEY[_0x193030(0x29a)](_0x193030(0x178)))return{'content':[{'type':_0x193030(0x260),'text':_0x193030(0x1f7)}],'isError':!![]};if(DISABLED_TOOLS[_0x193030(0x27d)](_0x47308c))return{'content':[{'type':'text','text':'Tool\x20\x22'+_0x47308c+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x47308c){case TOOL_NAMES['EDIT_FILE']:{let _0x2fec32=_0x1a046d;_0x2fec32&&typeof _0x2fec32==='object'&&(_0x193030(0x1ee)in _0x2fec32&&!(_0x193030(0x179)in _0x2fec32)&&(_0x2fec32={..._0x2fec32,'path':_0x2fec32[_0x193030(0x1ee)],'target_file':undefined}),_0x193030(0x280)in _0x2fec32&&!(_0x193030(0x28d)in _0x2fec32)&&(_0x2fec32={..._0x2fec32,'instruction':_0x2fec32[_0x193030(0x280)],'instructions':undefined}));const _0xfef00d=MorphEditFileArgsSchema[_0x193030(0x240)](_0x2fec32);if(!_0xfef00d['success'])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0xfef00d[_0x193030(0x21f)]);const _0x5bd2e8=await validatePath(_0xfef00d[_0x193030(0x234)][_0x193030(0x179)]);let _0x3107b1=null,_0x4b8886=!![],_0x49b4d3=null;try{_0x3107b1=await a0_0x13de7e['readFile'](_0x5bd2e8,_0x193030(0x277)),logger[_0x193030(0x1b9)](_0x193030(0x235),_0x193030(0x293),{'path':_0x5bd2e8,'size_bytes':_0x3107b1['length']});}catch(_0x10354b){const _0x47ae7d=_0x10354b[_0x193030(0x25c)];_0x47ae7d===_0x193030(0x16d)?(_0x4b8886=![],_0x3107b1='',logger[_0x193030(0x1b9)](_0x193030(0x235),_0x193030(0x293),{'path':_0x5bd2e8,'exists':![]})):(_0x49b4d3='Failed\x20to\x20read\x20file:\x20'+(_0x47ae7d||_0x193030(0x1d9))+_0x193030(0x1af)+(_0x10354b instanceof Error?_0x10354b[_0x193030(0x1ed)]:String(_0x10354b)),logger[_0x193030(0x21f)]('MCP','file_read_failed',{'path':_0x5bd2e8,'error':_0x49b4d3}),logMcpStderr('Warning:\x20'+_0x49b4d3));}let _0x10acf1;try{const _0x53da06=MORPH_API_KEY;if(!_0x53da06)throw new Error(_0x193030(0x252));const _0x15e2e2=a0_0x2c51d4['dirname'](_0x5bd2e8),_0x46ec9e=a0_0x2c51d4[_0x193030(0x1d4)](_0x5bd2e8);logger[_0x193030(0x1b9)]('MCP',_0x193030(0x218),{'model':_0x193030(0x216),'path':_0xfef00d[_0x193030(0x234)][_0x193030(0x179)],'instruction_len':_0xfef00d[_0x193030(0x234)][_0x193030(0x28d)][_0x193030(0x1e8)],'code_edit_len':_0xfef00d[_0x193030(0x234)]['code_edit'][_0x193030(0x1e8)],'original_code_len':_0x3107b1?.[_0x193030(0x1e8)]??0x0,'dry_run':_0xfef00d[_0x193030(0x234)][_0x193030(0x294)]});const _0x14fe4d=Date[_0x193030(0x17b)](),_0x22e690=await executeEditFile({'target_filepath':_0x46ec9e,'code_edit':_0xfef00d[_0x193030(0x234)]['code_edit'],'instruction':_0xfef00d['data'][_0x193030(0x28d)]},{'morphApiKey':_0x53da06,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x15e2e2,'autoWrite':!_0xfef00d[_0x193030(0x234)][_0x193030(0x294)],'generateUdiff':![],'debug':![]}),_0x520188=Date[_0x193030(0x17b)]()-_0x14fe4d;_0x10acf1=_0x22e690[_0x193030(0x1bb)];if(!_0x22e690[_0x193030(0x1bf)])throw new Error(_0x22e690[_0x193030(0x21f)]||_0x193030(0x282));const _0x148076=_0x22e690['changes'],_0x13c637=_0x193030(0x233)+_0x148076['linesAdded']+_0x193030(0x1eb)+_0x148076['linesRemoved']+_0x193030(0x1ff)+_0x148076[_0x193030(0x1c9)];logger['debug'](_0x193030(0x235),_0x193030(0x1e4),{'tool':'edit_file','success':!![],'latency_ms':Date[_0x193030(0x17b)]()-_0x43ba5c,'edit_latency_ms':_0x520188,'changes':{'added':_0x148076['linesAdded'],'removed':_0x148076[_0x193030(0x20f)],'modified':_0x148076[_0x193030(0x1c9)]},'completion_id':_0x10acf1});if(_0xfef00d[_0x193030(0x234)]['dryRun'])return{'content':[{'type':_0x193030(0x260),'text':_0x193030(0x206)+(_0x4b8886?'':_0x193030(0x22b))+':\x20'+_0xfef00d[_0x193030(0x234)][_0x193030(0x28d)]+_0x193030(0x1fd)+_0x13c637+'.\x20Path:\x20'+_0xfef00d[_0x193030(0x234)][_0x193030(0x179)]+'.'}]};return{'content':[{'type':_0x193030(0x260),'text':_0x193030(0x23c)+(_0x4b8886?'Applied':_0x193030(0x191))+':\x20'+_0xfef00d[_0x193030(0x234)][_0x193030(0x28d)]+_0x193030(0x1fd)+_0x13c637+_0x193030(0x269)+_0xfef00d['data']['path']+'.'}]};}catch(_0x586b56){const _0x3ae151=handleMorphAPIError(_0x586b56);if(_0x3ae151)return logger[_0x193030(0x21f)](_0x193030(0x235),_0x193030(0x25a),{'tool':_0x193030(0x17d),'error':_0x193030(0x261),'latency_ms':Date[_0x193030(0x17b)]()-_0x43ba5c}),_0x3ae151;const _0x321af9=_0x586b56 instanceof Error?_0x586b56[_0x193030(0x1ed)]:String(_0x586b56);return logger[_0x193030(0x21f)](_0x193030(0x235),_0x193030(0x25a),{'tool':_0x193030(0x17d),'error':_0x321af9,'path':_0xfef00d['data'][_0x193030(0x179)],'validated_path':_0x5bd2e8,'latency_ms':Date[_0x193030(0x17b)]()-_0x43ba5c,'stack':_0x586b56 instanceof Error?_0x586b56[_0x193030(0x274)]:undefined}),reportMorphError({'error_message':_0x321af9,'error_type':_0x586b56 instanceof Error?_0x586b56[_0x193030(0x251)]['name']:_0x193030(0x16b),'context':{'tool':'edit_file','completion_id':_0x10acf1,'file_path':_0xfef00d[_0x193030(0x234)][_0x193030(0x179)],'validated_path':_0x5bd2e8,'instruction':_0xfef00d[_0x193030(0x234)][_0x193030(0x28d)],'model':MORPH_LARGE_APPLY?_0x193030(0x230):_0x193030(0x216),'dry_run':_0xfef00d[_0x193030(0x234)][_0x193030(0x294)],'file_exists':_0x4b8886,'file_read_error':_0x49b4d3,'file_readable':_0x3107b1!==null,'request_content':{'path':_0xfef00d['data'][_0x193030(0x179)],'code_edit':_0xfef00d[_0x193030(0x234)][_0x193030(0x215)],'instruction':_0xfef00d['data'][_0x193030(0x28d)],'original_code':_0x3107b1!==null?_0x3107b1['length']>0xc350?_0x3107b1['substring'](0x0,0xc350)+_0x193030(0x1da)+_0x3107b1[_0x193030(0x1e8)]+_0x193030(0x21d):_0x3107b1:_0x193030(0x1b4)+(_0x49b4d3||'unknown\x20error')+']','original_code_length':_0x3107b1?.['length']??0x0,'model':MORPH_LARGE_APPLY?_0x193030(0x230):_0x193030(0x216),'dry_run':_0xfef00d['data'][_0x193030(0x294)]}},'stack_trace':_0x586b56 instanceof Error?_0x586b56[_0x193030(0x274)]:undefined,'source':_0x193030(0x236)})[_0x193030(0x292)](()=>{}),{'content':[{'type':_0x193030(0x260),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x321af9}],'isError':!![]};}}case TOOL_NAMES['CODEBASE_SEARCH']:{const _0xdc2a2c=WarpGrepArgsSchema[_0x193030(0x240)](_0x1a046d);if(!_0xdc2a2c[_0x193030(0x1bf)])return{'content':[{'type':'text','text':_0x193030(0x28c)+_0xdc2a2c[_0x193030(0x21f)]}],'isError':!![]};const _0x1b048a=_0x394e87=>{const _0x43613b=_0x193030,_0xf312fa=[];for(const _0xafd00d of _0x394e87||[]){if(_0xafd00d['role']==='assistant'&&Array[_0x43613b(0x28f)](_0xafd00d[_0x43613b(0x189)]))for(const _0x8eeb2e of _0xafd00d['tool_calls']){try{const _0x4a943c=_0x8eeb2e['function']?.[_0x43613b(0x24e)],_0x1db02f=JSON['parse'](_0x8eeb2e['function']?.['arguments']||'{}');if(_0x4a943c===_0x43613b(0x299))_0xf312fa[_0x43613b(0x298)](_0x43613b(0x1e3)+_0x1db02f[_0x43613b(0x22a)]+'\x27\x20'+(_0x1db02f[_0x43613b(0x179)]||'.'));else{if(_0x4a943c===_0x43613b(0x237))_0xf312fa[_0x43613b(0x298)](_0x43613b(0x172)+_0x1db02f[_0x43613b(0x179)]);else{if(_0x4a943c===_0x43613b(0x209))_0xf312fa[_0x43613b(0x298)]('list_directory\x20'+(_0x1db02f[_0x43613b(0x1f2)]||'.'));else{if(_0x4a943c==='glob')_0xf312fa['push'](_0x43613b(0x1e7)+_0x1db02f[_0x43613b(0x22a)]+'\x27\x20'+(_0x1db02f[_0x43613b(0x179)]||'.'));else _0x4a943c===_0x43613b(0x229)&&_0xf312fa[_0x43613b(0x298)]('finish');}}}}catch{}}}return _0xf312fa;},_0x45b3ea=_0x5d27b5=>{const _0x3f6e52=_0x193030,_0x53ca95=[];if(!_0x5d27b5||!Array[_0x3f6e52(0x28f)](_0x5d27b5))return _0x53ca95;const _0x880a58=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x3f6e52(0x268),'tool':_0x3f6e52(0x237)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x3f6e52(0x237)},{'pattern':/\[READ ERROR\]/,'error_type':_0x3f6e52(0x25f),'tool':_0x3f6e52(0x237)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':_0x3f6e52(0x19b)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x3f6e52(0x1bd),'tool':_0x3f6e52(0x19b)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x3f6e52(0x20c),'tool':_0x3f6e52(0x237)},{'pattern':/\[SYMLINK\]/,'error_type':_0x3f6e52(0x226),'tool':_0x3f6e52(0x237)},{'pattern':/not a text file/,'error_type':'BinaryFile','tool':_0x3f6e52(0x237)},{'pattern':/symbolic link/,'error_type':_0x3f6e52(0x226),'tool':_0x3f6e52(0x237)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':'read'},{'pattern':/status="error"/,'error_type':'ToolException','tool':_0x3f6e52(0x1d9)}];let _0x184cba=0x0;for(const _0xd22ecf of _0x5d27b5){_0xd22ecf[_0x3f6e52(0x253)]===_0x3f6e52(0x220)&&Array['isArray'](_0xd22ecf[_0x3f6e52(0x189)])&&_0x184cba++;const _0x15a1f1=_0xd22ecf['content'];if((_0xd22ecf['role']===_0x3f6e52(0x28b)||_0xd22ecf[_0x3f6e52(0x253)]===_0x3f6e52(0x1c7))&&_0x15a1f1&&typeof _0x15a1f1===_0x3f6e52(0x225))for(const {pattern:_0x184ac3,error_type:_0x25e5f7,tool:_0x3597a2}of _0x880a58){const _0x2ea112=_0x15a1f1['match'](new RegExp(_0x184ac3[_0x3f6e52(0x1a8)],'g'));if(_0x2ea112)for(const _0x2a8971 of _0x2ea112){const _0x45dd9e=_0x15a1f1[_0x3f6e52(0x29c)](_0x2a8971),_0x12bf6a=_0x15a1f1[_0x3f6e52(0x284)](_0x45dd9e,Math['min'](_0x45dd9e+0xc8,_0x15a1f1[_0x3f6e52(0x1e8)]));_0x53ca95[_0x3f6e52(0x298)]({'tool':_0x3597a2,'error_type':_0x25e5f7,'error_message':_0x12bf6a[_0x3f6e52(0x1df)]('\x0a')[0x0],'turn':_0x184cba});}}}return _0x53ca95;};try{const _0x493336=a0_0x2c51d4['resolve'](_0xdc2a2c[_0x193030(0x234)][_0x193030(0x23e)]),_0x158778=_0xdc2a2c[_0x193030(0x234)]['search_type'],_0x518dfe=_0x158778===_0x193030(0x26d)?{'allowNames':['node_modules']}:undefined,_0x3af8ee=new LocalRipgrepProvider(_0x493336,undefined,_0x518dfe);logger[_0x193030(0x1b9)](_0x193030(0x235),'provider_created',{'type':_0x193030(0x286),'repo_root':_0x493336,'search_type':_0x158778||'default'}),logger[_0x193030(0x1b9)](_0x193030(0x235),'warp_grep_start',{'query':_0xdc2a2c['data'][_0x193030(0x242)],'repo_root':_0x493336,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x1da06f=Date[_0x193030(0x17b)](),_0x20516b=await runWarpGrep({'searchTerm':_0xdc2a2c[_0x193030(0x234)][_0x193030(0x242)],'repoRoot':_0x493336,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x3af8ee,'search_type':_0x158778}),_0x5ddec5=Date[_0x193030(0x17b)]()-_0x1da06f,_0x3f6dab=_0x20516b[_0x193030(0x229)]?.[_0x193030(0x231)]?.[_0x193030(0x257)]?.[_0x193030(0x1e8)]??0x0;logger[_0x193030(0x1b9)]('MCP',_0x193030(0x246),{'termination':_0x20516b[_0x193030(0x183)],'turns':_0x20516b[_0x193030(0x287)]?.[_0x193030(0x1cd)]??0x0,'files_found':_0x3f6dab,'latency_ms':_0x5ddec5});const _0x3e991c=_0x45b3ea(_0x20516b['messages']);_0x3e991c[_0x193030(0x1e8)]>0x0&&reportMorphError({'error_message':_0x193030(0x188)+_0x3e991c[_0x193030(0x1e8)]+_0x193030(0x22e),'error_type':_0x193030(0x28e),'level':_0x193030(0x283),'tool':_0x193030(0x212),'context':{'repo_path':_0xdc2a2c[_0x193030(0x234)][_0x193030(0x23e)],'query':_0xdc2a2c[_0x193030(0x234)][_0x193030(0x242)],'model':_0x193030(0x1f4),'termination_reason':_0x20516b['terminationReason'],'sub_tool_errors':_0x3e991c,'timings':_0x20516b['timings'],'tool_calls':_0x1b048a(_0x20516b['messages']),'messages':_0x20516b[_0x193030(0x1a6)]?.['map'](_0x2f6189=>({'role':_0x2f6189[_0x193030(0x253)],'content':_0x2f6189['content'],..._0x2f6189['tool_calls']?{'tool_calls':_0x2f6189[_0x193030(0x189)][_0x193030(0x1e8)]}:{},..._0x2f6189[_0x193030(0x1fb)]?{'tool_call_id':_0x2f6189[_0x193030(0x1fb)]}:{}}))},'source':_0x193030(0x236)})[_0x193030(0x292)](()=>{});let _0x3ada98='';if(_0x20516b[_0x193030(0x183)]==='completed'&&_0x20516b[_0x193030(0x229)]?.[_0x193030(0x231)]?.[_0x193030(0x257)]){const _0x15a9d2=_0x20516b[_0x193030(0x229)][_0x193030(0x231)][_0x193030(0x257)];if(_0x15a9d2['length']===0x0)return _0x3ada98=_0x20516b[_0x193030(0x229)][_0x193030(0x19e)]||_0x193030(0x200),{'content':[{'type':'text','text':_0x3ada98}]};const _0x51d8e7=[],_0x15201a=[_0x193030(0x185)];for(const _0x247d9a of _0x20516b[_0x193030(0x1a6)]){if(_0x247d9a[_0x193030(0x253)]===_0x193030(0x220)&&Array[_0x193030(0x28f)](_0x247d9a[_0x193030(0x189)]))for(const _0x542109 of _0x247d9a[_0x193030(0x189)]){try{const _0x264ebe=_0x542109[_0x193030(0x1cf)]?.['name'],_0x15f66e=JSON['parse'](_0x542109[_0x193030(0x1cf)]?.[_0x193030(0x26b)]||'{}');if(_0x264ebe===_0x193030(0x299))_0x15201a[_0x193030(0x298)]('-\x20Grepped\x20\x27'+_0x15f66e[_0x193030(0x22a)]+_0x193030(0x25b)+(_0x15f66e[_0x193030(0x179)]||'.')+'`');else{if(_0x264ebe===_0x193030(0x237))_0x15201a[_0x193030(0x298)](_0x193030(0x1ad)+_0x15f66e[_0x193030(0x179)]+'`');else{if(_0x264ebe==='list_directory')_0x15201a[_0x193030(0x298)](_0x193030(0x193)+(_0x15f66e[_0x193030(0x1f2)]||'.')+'`');else _0x264ebe===_0x193030(0x1a7)&&_0x15201a[_0x193030(0x298)](_0x193030(0x1ea)+_0x15f66e[_0x193030(0x22a)]+'`\x20in\x20`'+(_0x15f66e[_0x193030(0x179)]||'.')+'`');}}}catch{}}}_0x51d8e7['push'](_0x15201a[_0x193030(0x208)]('\x0a'));const _0x37bb12=['',_0x193030(0x288)];for(const _0x3bc47c of _0x15a9d2){if(_0x3bc47c[_0x193030(0x18f)]==='*')_0x37bb12[_0x193030(0x298)]('-\x20'+_0x3bc47c[_0x193030(0x179)]+':*');else{if(Array[_0x193030(0x28f)](_0x3bc47c[_0x193030(0x18f)])){const _0x24694b=_0x3bc47c[_0x193030(0x18f)][_0x193030(0x1a2)](([_0xc1fec6,_0x2a6839])=>{if(_0xc1fec6===_0x2a6839)return''+_0xc1fec6;return _0xc1fec6+'-'+_0x2a6839;});_0x37bb12[_0x193030(0x298)]('-\x20'+_0x3bc47c[_0x193030(0x179)]+':'+_0x24694b[_0x193030(0x208)](','));}else _0x37bb12[_0x193030(0x298)]('-\x20'+_0x3bc47c[_0x193030(0x179)]+':*');}}_0x37bb12['push'](''),_0x51d8e7[_0x193030(0x298)](_0x37bb12[_0x193030(0x208)]('\x0a')),_0x51d8e7[_0x193030(0x298)](_0x193030(0x176));const _0x156a88=[],_0x567931=[];for(const _0x3fdc51 of _0x15a9d2){let _0x429e02=a0_0x2c51d4[_0x193030(0x1c2)](_0xdc2a2c[_0x193030(0x234)][_0x193030(0x23e)],_0x3fdc51[_0x193030(0x179)]),_0x39bc27=null,_0x8f46b7=null;try{_0x39bc27=await a0_0x13de7e[_0x193030(0x263)](_0x429e02,{'encoding':'utf-8'});}catch(_0x2060ce){const _0x45a620=fixPathRepetition(_0x429e02);if(_0x45a620)try{_0x39bc27=await a0_0x13de7e[_0x193030(0x263)](_0x45a620,{'encoding':_0x193030(0x277)}),_0x429e02=_0x45a620;}catch{_0x8f46b7=_0x2060ce instanceof Error?_0x2060ce:new Error(String(_0x2060ce));}else _0x8f46b7=_0x2060ce instanceof Error?_0x2060ce:new Error(String(_0x2060ce));}if(_0x39bc27!==null){const _0x2f4fe6=_0x39bc27[_0x193030(0x1df)](/\r?\n/),_0x48100c=[];if(_0x3fdc51[_0x193030(0x18f)]==='*'||!Array[_0x193030(0x28f)](_0x3fdc51['lines']))for(let _0x4b6a69=0x1;_0x4b6a69<=_0x2f4fe6[_0x193030(0x1e8)];_0x4b6a69++){const _0x3db030=_0x2f4fe6[_0x4b6a69-0x1];_0x48100c[_0x193030(0x298)](_0x4b6a69+'|\x20'+_0x3db030);}else for(const [_0x315752,_0x35d730]of _0x3fdc51[_0x193030(0x18f)]){_0x48100c[_0x193030(0x1e8)]>0x0&&_0x48100c['push']('');for(let _0x554536=_0x315752;_0x554536<=_0x35d730&&_0x554536<=_0x2f4fe6[_0x193030(0x1e8)];_0x554536++){const _0x268eeb=_0x2f4fe6[_0x554536-0x1];_0x48100c[_0x193030(0x298)](_0x554536+'|\x20'+_0x268eeb);}}_0x567931['push']({'path':_0x3fdc51[_0x193030(0x179)],'content':_0x48100c[_0x193030(0x208)]('\x0a')});}else _0x156a88[_0x193030(0x298)](_0x193030(0x289)+_0x3fdc51['path']+_0x193030(0x1c0)+(_0x8f46b7?.[_0x193030(0x1ed)]||_0x193030(0x24a))+'\x0a</file>');}try{const _0xa63c95=await compactFileContexts(_0x567931,_0xdc2a2c['data'][_0x193030(0x242)],MORPH_API_KEY,MORPH_API_URL);for(const _0x3ba41e of _0xa63c95){_0x156a88[_0x193030(0x298)](_0x193030(0x289)+_0x3ba41e['path']+_0x193030(0x24c)+_0x3ba41e['content']+'\x0a</file>');}}catch(_0x577816){logger['warn'](_0x193030(0x235),_0x193030(0x1d2),{'error':_0x577816 instanceof Error?_0x577816[_0x193030(0x1ed)]:String(_0x577816),'files_count':_0x567931[_0x193030(0x1e8)]});for(const _0x399594 of _0x567931){_0x156a88['push'](_0x193030(0x289)+_0x399594[_0x193030(0x179)]+_0x193030(0x24c)+_0x399594[_0x193030(0x27a)]+_0x193030(0x20e));}}_0x51d8e7[_0x193030(0x298)](_0x156a88[_0x193030(0x208)]('\x0a\x0a')),_0x3ada98=_0x51d8e7[_0x193030(0x208)]('\x0a');const _0x2727c8=_0x20516b['errors']?.[_0x193030(0x1be)](_0x136237=>_0x136237[_0x193030(0x1ed)]?.[_0x193030(0x29a)]('File\x20read\x20error:'))||[];if(_0x2727c8[_0x193030(0x1e8)]>0x0){const _0x32ab68=_0x2727c8['map'](_0x5115c9=>_0x5115c9[_0x193030(0x1ed)])[_0x193030(0x208)](';\x20');reportMorphError({'error_message':_0x32ab68,'error_type':'FileReadError','context':{'tool':_0x193030(0x212),'repo_path':_0xdc2a2c['data'][_0x193030(0x23e)],'query':_0xdc2a2c[_0x193030(0x234)]['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0x193030(0x23d),'error_count':_0x2727c8['length'],'is_timeout':![],'timings':_0x20516b[_0x193030(0x287)],'files_attempted':_0x15a9d2[_0x193030(0x1a2)](_0x5440b6=>({'path':_0x5440b6[_0x193030(0x179)],'lines':_0x5440b6[_0x193030(0x18f)]})),'tool_calls':_0x1b048a(_0x20516b[_0x193030(0x1a6)]),'messages':_0x20516b[_0x193030(0x1a6)]?.['map'](_0x48acd9=>({'role':_0x48acd9['role'],'content':_0x48acd9[_0x193030(0x27a)],..._0x48acd9['tool_calls']?{'tool_calls':_0x48acd9[_0x193030(0x189)][_0x193030(0x1e8)]}:{},..._0x48acd9['tool_call_id']?{'tool_call_id':_0x48acd9['tool_call_id']}:{}})),'request_content':{'query':_0xdc2a2c[_0x193030(0x234)][_0x193030(0x242)],'repo_path':_0xdc2a2c[_0x193030(0x234)]['repo_path'],'repoRoot':a0_0x2c51d4['resolve'](_0xdc2a2c[_0x193030(0x234)][_0x193030(0x23e)]),'model':_0x193030(0x1f4)}},'source':'mcp-filesystem'})[_0x193030(0x292)](()=>{});}}else{if(_0x20516b[_0x193030(0x183)]==='terminated'&&_0x20516b[_0x193030(0x258)]['length']>0x0){const _0x91a188=_0x20516b['errors']['map'](_0x5a491a=>_0x5a491a[_0x193030(0x1ed)])[_0x193030(0x208)](';\x20');_0x3ada98=_0x193030(0x1e0)+_0x91a188;const _0x3cba8a=_0x91a188[_0x193030(0x17c)]()[_0x193030(0x1de)](_0x193030(0x244))||_0x91a188[_0x193030(0x17c)]()['includes'](_0x193030(0x255))||_0x91a188[_0x193030(0x17c)]()[_0x193030(0x1de)](_0x193030(0x16e)),_0x15efb2=_0x20516b['finish']?.[_0x193030(0x231)]?.[_0x193030(0x257)],_0x41177f=_0x20516b['errors'][0x0];reportMorphError({'error_message':_0x91a188,'error_type':_0x3cba8a?_0x193030(0x279):_0x41177f?.['constructor']?.[_0x193030(0x24e)]||'WarpGrepError','context':{'tool':'codebase_search','repo_path':_0xdc2a2c[_0x193030(0x234)][_0x193030(0x23e)],'query':_0xdc2a2c[_0x193030(0x234)]['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0x20516b[_0x193030(0x183)],'error_count':_0x20516b[_0x193030(0x258)]['length'],'is_timeout':_0x3cba8a,'timings':_0x20516b[_0x193030(0x287)],'files_attempted':_0x15efb2?.['map'](_0x5d7413=>({'path':_0x5d7413[_0x193030(0x179)],'lines':_0x5d7413[_0x193030(0x18f)]})),'tool_calls':_0x1b048a(_0x20516b[_0x193030(0x1a6)]),'messages':_0x20516b['messages']?.[_0x193030(0x1a2)](_0x2eb438=>({'role':_0x2eb438[_0x193030(0x253)],'content':_0x2eb438[_0x193030(0x27a)],..._0x2eb438['tool_calls']?{'tool_calls':_0x2eb438['tool_calls'][_0x193030(0x1e8)]}:{},..._0x2eb438[_0x193030(0x1fb)]?{'tool_call_id':_0x2eb438[_0x193030(0x1fb)]}:{}})),'request_content':{'query':_0xdc2a2c[_0x193030(0x234)]['search_string'],'repo_path':_0xdc2a2c[_0x193030(0x234)][_0x193030(0x23e)],'repoRoot':a0_0x2c51d4[_0x193030(0x1c2)](_0xdc2a2c['data']['repo_path']),'model':_0x193030(0x1f4)}},'stack_trace':_0x41177f?.[_0x193030(0x274)]||undefined,'source':_0x193030(0x236)})[_0x193030(0x292)](()=>{});}else _0x3ada98='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':_0x193030(0x260),'text':_0x3ada98}]};}catch(_0x3e5ed0){const _0x420a7f=handleMorphAPIError(_0x3e5ed0);if(_0x420a7f)return logger[_0x193030(0x21f)](_0x193030(0x235),_0x193030(0x25a),{'tool':'codebase_search','error':_0x193030(0x261),'latency_ms':Date[_0x193030(0x17b)]()-_0x43ba5c}),_0x420a7f;const _0x1e6222=_0x3e5ed0 instanceof Error?_0x3e5ed0[_0x193030(0x1ed)]:String(_0x3e5ed0);logger[_0x193030(0x21f)]('MCP',_0x193030(0x25a),{'tool':_0x193030(0x212),'error':_0x1e6222,'repo_path':_0xdc2a2c[_0x193030(0x234)][_0x193030(0x23e)],'query':_0xdc2a2c['data'][_0x193030(0x242)],'latency_ms':Date[_0x193030(0x17b)]()-_0x43ba5c});const _0x34028e=_0x1e6222[_0x193030(0x17c)]()[_0x193030(0x1de)](_0x193030(0x244))||_0x1e6222[_0x193030(0x17c)]()[_0x193030(0x1de)](_0x193030(0x255))||_0x1e6222[_0x193030(0x17c)]()[_0x193030(0x1de)](_0x193030(0x16e))||_0x3e5ed0 instanceof Error&&_0x3e5ed0[_0x193030(0x24e)]==='TimeoutError';return reportMorphError({'error_message':_0x1e6222,'error_type':_0x34028e?_0x193030(0x279):_0x3e5ed0 instanceof Error?_0x3e5ed0['constructor']['name']:_0x193030(0x16b),'context':{'tool':'codebase_search','repo_path':_0xdc2a2c[_0x193030(0x234)]['repo_path'],'query':_0xdc2a2c['data']['search_string'],'model':_0x193030(0x1f4),'is_timeout':_0x34028e,'exception_phase':_0x193030(0x204),'request_content':{'query':_0xdc2a2c[_0x193030(0x234)][_0x193030(0x242)],'repo_path':_0xdc2a2c[_0x193030(0x234)]['repo_path'],'repoRoot':a0_0x2c51d4[_0x193030(0x1c2)](_0xdc2a2c[_0x193030(0x234)][_0x193030(0x23e)]),'model':_0x193030(0x1f4)}},'stack_trace':_0x3e5ed0 instanceof Error?_0x3e5ed0['stack']:undefined,'source':_0x193030(0x236)})[_0x193030(0x292)](()=>{}),{'content':[{'type':'text','text':_0x193030(0x186)+_0x1e6222}],'isError':![]};}}case TOOL_NAMES[_0x193030(0x285)]:{const _0xe22581=WarpGrepGitHubArgsSchema[_0x193030(0x240)](_0x1a046d);if(!_0xe22581['success'])return{'content':[{'type':_0x193030(0x260),'text':'Invalid\x20arguments:\x20'+_0xe22581[_0x193030(0x21f)]}],'isError':!![]};const _0x3added=_0xe22581[_0x193030(0x234)][_0x193030(0x222)]||_0xe22581[_0x193030(0x234)]['owner_repo'];if(!_0x3added)return{'content':[{'type':_0x193030(0x260),'text':_0x193030(0x21b)}],'isError':!![]};const _0x7e54cd=MORPH_API_KEY;if(!_0x7e54cd)throw new Error(_0x193030(0x252));const _0x5505a8=Date[_0x193030(0x17b)]();logger[_0x193030(0x1b9)](_0x193030(0x235),_0x193030(0x24d),{'identifier':_0x3added,'query':_0xe22581[_0x193030(0x234)][_0x193030(0x242)],'branch':_0xe22581['data'][_0x193030(0x24f)]});try{const _0x5f3c83=new WarpGrepClient({'morphApiKey':_0x7e54cd,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x239835=await _0x5f3c83[_0x193030(0x1ba)]({'searchTerm':_0xe22581[_0x193030(0x234)][_0x193030(0x242)],'github':_0x3added,'branch':_0xe22581[_0x193030(0x234)]['branch']}),_0x5375d1=Date['now']()-_0x5505a8;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x5375d1+_0x193030(0x181)+_0x239835[_0x193030(0x1bf)]);const _0x2aba69=formatResult(_0x239835);return{'content':[{'type':_0x193030(0x260),'text':_0x2aba69}]};}catch(_0x1d7750){const _0x72828d=handleMorphAPIError(_0x1d7750);if(_0x72828d)return _0x72828d;const _0x2674e2=Date[_0x193030(0x17b)]()-_0x5505a8,_0x1f883b=_0x1d7750 instanceof Error?_0x1d7750[_0x193030(0x1ed)]:String(_0x1d7750);return logMcpStderr(_0x193030(0x19d)+_0x2674e2+_0x193030(0x17a),_0x1f883b),reportMorphError({'error_message':_0x1f883b,'error_type':_0x1d7750 instanceof Error?_0x1d7750['constructor']['name']:_0x193030(0x16b),'context':{'tool':_0x193030(0x1ab),'github_url':_0x3added,'search_string':_0xe22581['data'][_0x193030(0x242)],'branch':_0xe22581[_0x193030(0x234)][_0x193030(0x24f)]},'stack_trace':_0x1d7750 instanceof Error?_0x1d7750[_0x193030(0x274)]:undefined,'source':_0x193030(0x236),'tool':_0x193030(0x1ab),'latency_ms':_0x2674e2})[_0x193030(0x292)](()=>{}),{'content':[{'type':_0x193030(0x260),'text':_0x193030(0x1b6)+_0x1f883b}],'isError':![]};}}default:throw new Error(_0x193030(0x273)+_0x47308c);}}catch(_0x5e00db){const _0x18af38=_0x5e00db instanceof Error?_0x5e00db[_0x193030(0x1ed)]:String(_0x5e00db);return reportMorphError({'error_message':_0x18af38,'error_type':_0x5e00db instanceof Error?_0x5e00db[_0x193030(0x251)]['name']:_0x193030(0x16b),'context':{'tool':_0x47308c,'arguments':_0x1a046d?JSON[_0x193030(0x27c)](_0x1a046d)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x193030(0x1fc)},'stack_trace':_0x5e00db instanceof Error?_0x5e00db['stack']:undefined,'source':_0x193030(0x236)})[_0x193030(0x292)](()=>{}),{'content':[{'type':'text','text':_0x193030(0x1e0)+_0x18af38}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x15f759){const _0x1abca0=a0_0x5f4091,_0x174163=await getValidRootDirectories(_0x15f759);if(_0x174163[_0x1abca0(0x1e8)]>0x0)allowedDirectories=[..._0x174163],logMcpStderr(_0x1abca0(0x23b)+_0x174163['length']+_0x1abca0(0x1d0));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x45ba4c=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x45ba4c&&(allowedDirectories=[_0x45ba4c],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x45ba4c));}catch(_0x1bc12f){logMcpStderr(_0x1abca0(0x1c4)+_0x1bc12f);}}}server[a0_0x5f4091(0x22f)](RootsListChangedNotificationSchema,async()=>{const _0x57d9fc=a0_0x5f4091;try{const _0x27774e=await server['listRoots']();_0x27774e&&_0x57d9fc(0x203)in _0x27774e&&await updateAllowedDirectoriesFromRoots(_0x27774e[_0x57d9fc(0x203)]);}catch(_0x23c586){logMcpStderr(_0x57d9fc(0x201),_0x23c586 instanceof Error?_0x23c586['message']:String(_0x23c586));}}),server[a0_0x5f4091(0x1db)]=async()=>{const _0x242cf0=a0_0x5f4091,_0x142df3=server[_0x242cf0(0x196)]();if(_0x142df3?.[_0x242cf0(0x203)])try{const _0x5efda7=await server[_0x242cf0(0x19f)]();_0x5efda7&&'roots'in _0x5efda7?await updateAllowedDirectoriesFromRoots(_0x5efda7['roots']):logMcpStderr(_0x242cf0(0x190));}catch(_0x514887){logMcpStderr(_0x242cf0(0x182),_0x514887 instanceof Error?_0x514887[_0x242cf0(0x1ed)]:String(_0x514887));}else{if(allowedDirectories[_0x242cf0(0x1e8)]>0x0)logMcpStderr(_0x242cf0(0x1f0),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x242cf0(0x1f1));else throw new Error(_0x242cf0(0x1f5));}}};async function runServer(){const _0x2fb0b6=a0_0x5f4091,_0x33ab8c=new StdioServerTransport();await server[_0x2fb0b6(0x211)](_0x33ab8c),logMcpStderr(_0x2fb0b6(0x173)),allowedDirectories['length']===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()['catch'](_0x124b06=>{const _0x201eb1=a0_0x5f4091;logMcpStderr(_0x201eb1(0x1d3),_0x124b06),process[_0x201eb1(0x278)](0x1);});
2
+ const a0_0x28086a=a0_0x9f0d;(function(_0x2ab0d4,_0x491bea){const _0xbadadd=a0_0x9f0d,_0x5a4802=_0x2ab0d4();while(!![]){try{const _0x1afbaf=parseInt(_0xbadadd(0x127))/0x1+-parseInt(_0xbadadd(0x132))/0x2*(-parseInt(_0xbadadd(0xc8))/0x3)+-parseInt(_0xbadadd(0x1a3))/0x4*(parseInt(_0xbadadd(0x1a5))/0x5)+-parseInt(_0xbadadd(0x126))/0x6*(-parseInt(_0xbadadd(0x111))/0x7)+parseInt(_0xbadadd(0xf1))/0x8*(parseInt(_0xbadadd(0x1a1))/0x9)+parseInt(_0xbadadd(0x84))/0xa+-parseInt(_0xbadadd(0x134))/0xb;if(_0x1afbaf===_0x491bea)break;else _0x5a4802['push'](_0x5a4802['shift']());}catch(_0x4040c9){_0x5a4802['push'](_0x5a4802['shift']());}}}(a0_0x3353,0x241af));function a0_0x9f0d(_0x2b2d1a,_0x325cea){_0x2b2d1a=_0x2b2d1a-0x7a;const _0x335316=a0_0x3353();let _0x9f0d9f=_0x335316[_0x2b2d1a];return _0x9f0d9f;}import{Server}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x3353(){const _0x5bf076=['string','linesModified','\x20is\x20not\x20a\x20directory','files','resolve','filter','terminationReason','optional','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','indexOf','match','pyproject.toml','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','File\x20read\x20error:','application/json','sk-','list_directory\x20','273fJhEuM','array','branch','false','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','tool_call_received','grep','MORPH_API_URL','.\x20Changes:\x20','morph-mcp','.\x20Path:\x20','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','warn','\x20as\x20allowed\x20directory','REQUIRED\x20parameters:\x20`path`\x20(absolute\x20file\x20path),\x20`code_edit`\x20(the\x20new\x20code\x20with\x20placeholders\x20for\x20unchanged\x20sections),\x20`instruction`\x20(brief\x20description\x20of\x20the\x20change).\x20Do\x20NOT\x20use\x20`target_file`,\x20`filePath`,\x20`code`,\x20or\x20`instructions`\x20—\x20use\x20the\x20exact\x20names\x20listed\x20here.\x0a\x0a','linesRemoved','version','has','added\x20','LocalRipgrepProvider','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','11694gwnpRD','146040gdbVus','sep','ENOENT','assistant','morph-warp-grep-v2.1','parse','Repository\x20identifier','WarpGrep\x20sub-tool\x20errors:\x20','Max\x20results\x20to\x20return','isDirectory','Tool\x20\x22','358178lvORtC','Error\x20accessing\x20directory\x20','5449763hUWRVP','\x22>\x0aError\x20reading\x20file:\x20','role','length','github_url','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','instructions','some','basename','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','path_validation_resolved','terminated','timed\x20out','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','slice','search_string','function','api_request_start','instruction','PWD','floor','EDIT_FILE','MCP','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','Unknown\x20tool:\x20','constructor','https://morphllm.com/api/error-report','DISABLED_TOOLS','For\x20deletions:\x0a','tool_calls','search_type','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','grep_search','setRequestHandler','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','payload','messages','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','[github_codebase_search]\x20Done\x20in\x20','success','all','API\x20error\x20(auth/rate-limit)','--help','FileNotFound','repo_path','Bearer\x20','size','debug','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','log','morph-v3-large','completed_with_file_errors','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','completionId','\x20valid\x20directories','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','\x20error(s)','Specific\x20commit\x20hash\x20to\x20search','target_file','Here\x20is\x20the\x20content\x20of\x20files:\x0a','TimeoutError','FileReadError','enum','trim','-\x20Read\x20file\x20`','searchGitHub','ENABLE_WORKSPACE_MODE','github_codebase_search','warp_grep_start','--version','dryRun','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','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','\x0aExamples:','lines','data','\x20\x20morph-mcp','default','now','glob\x20\x27','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','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.','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','connect','Rules:\x0a','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','edit_file','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','toISOString','access','status','target_filepath','RipgrepError','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','mcp-filesystem','command','\x22>\x0a','getClientCapabilities','\x20-\x20','safeParse','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','every','api-key','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','.vscode','errors','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','505341WPZIEi','ms.\x20Success:\x20','114872LQYrdf','file_path','30kudCxO','inputSchema','SubToolError','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.','GITHUB_CODEBASE_SEARCH','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','Failed\x20to\x20request\x20roots\x20from\x20client:','code_edit','error','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','dirname','\x20(new\x20file)','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.','tsconfig.json','package.json','code','2460410RfjAsV','Disabled\x20tools:\x20','setNotificationHandler','describe','read','warp_grep_complete','Cargo.toml','node_modules','Created\x20File','morph-v3-fast','BinaryFile','runWarpGrep_call','.cursor','substring','linesAdded','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','codebase_search','user','split','--api-key','boolean','[github_codebase_search]\x20Failed\x20in\x20','file_read_complete','metadata','catch','ReadError','new_string','go.mod','message','response','0.2.0','-\x20Grepped\x20\x27','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Parent\x20directory\x20does\x20not\x20exist:\x20','SymlinkError','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Invalid\x20arguments:\x20','@morphllm/morphmcp\x20','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','object','path_validation_failed','name','content','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','Authentication\x20failed:\x20Your\x20Morph\x20API\x20key\x20is\x20invalid\x20or\x20has\x20been\x20revoked.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key,\x20then\x20update\x20your\x20MCP\x20configuration.','provider_created','<file\x20path=\x22','\x0a</file>','UnknownError','tool','roots','path_validation_start','tool_call_error','listRoots','readFile','oninitialized','owner_repo','stat','pattern','text','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','Fatal\x20error\x20running\x20server:','timeout','Unknown\x20error','CODEBASE_SEARCH','RipgrepNotAvailable','3rslPUw','\x22.\x20Known\x20tools:\x20','edit','includes','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','join','composer.json','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','filePath','Warning:\x20','requiresApiKey','Morph\x20FastApply\x20failed\x20without\x20error\x20message','unknown','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','env','context','\x27\x20in\x20`','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','ms:','startsWith','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','tool_call_id','utf-8','MORPH_WARP_GREP_TIMEOUT','path','map','exit','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','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.','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','github_search_start','Morph\x20Edit\x20','turns','realpath','ToolException','24usxjyz','isArray','Fallback:\x20Using\x20workspace\x20root\x20','timings','push','\x20chars)','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','arguments','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','Error:\x20','stack','grep\x20\x27','finish','toLowerCase','morph-'];a0_0x3353=function(){return _0x5bf076;};return a0_0x3353();}import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x528ac2 from'fs/promises';import a0_0x577282 from'path';import a0_0x37efbe 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_0x2053fa from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x441172){const _0x5d13d6=a0_0x9f0d,_0x55f050=_0x441172[_0x5d13d6(0x97)](a0_0x577282[_0x5d13d6(0x128)])[_0x5d13d6(0x105)](Boolean);if(_0x55f050[_0x5d13d6(0x137)]<0x2)return null;for(let _0x58c94b=Math[_0x5d13d6(0x148)](_0x55f050['length']/0x2);_0x58c94b>=0x1;_0x58c94b--){for(let _0x5b6a27=0x0;_0x5b6a27<=_0x55f050[_0x5d13d6(0x137)]-0x2*_0x58c94b;_0x5b6a27++){const _0x2d2cf8=_0x55f050[_0x5d13d6(0x142)](_0x5b6a27,_0x5b6a27+_0x58c94b),_0x4abe52=_0x55f050[_0x5d13d6(0x142)](_0x5b6a27+_0x58c94b,_0x5b6a27+0x2*_0x58c94b);if(_0x2d2cf8[_0x5d13d6(0x19a)]((_0x38fd8b,_0x30e2f6)=>_0x38fd8b===_0x4abe52[_0x30e2f6])){const _0x5530b6=[..._0x55f050['slice'](0x0,_0x5b6a27),..._0x55f050[_0x5d13d6(0x142)](_0x5b6a27+_0x58c94b)];return a0_0x577282['sep']+_0x5530b6[_0x5d13d6(0xce)](a0_0x577282[_0x5d13d6(0x128)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0xefb79a=a0_0x9f0d;try{const _0x4e376b=require('../package.json');return _0x4e376b[_0xefb79a(0x121)]??_0xefb79a(0xd5);}catch(_0x35c14c){return logMcpStderr(_0xefb79a(0x153),_0x35c14c),_0xefb79a(0xd5);}}function printHelp(){const _0x8826f1=a0_0x9f0d;console[_0x8826f1(0x165)](_0x8826f1(0xaa)+getPackageVersion()),console[_0x8826f1(0x165)](_0x8826f1(0xe8)),console[_0x8826f1(0x165)]('\x0aOptions:'),console[_0x8826f1(0x165)](_0x8826f1(0x168)),console[_0x8826f1(0x165)](_0x8826f1(0xe1)),console[_0x8826f1(0x165)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x8826f1(0x165)](_0x8826f1(0x17d)),console['log'](_0x8826f1(0x180)),console['log'](_0x8826f1(0x139));}const cliArgs=process['argv'][a0_0x28086a(0x142)](0x2),VERSION_FLAGS=new Set([a0_0x28086a(0x179),'-v','-V']),HELP_FLAGS=new Set([a0_0x28086a(0x15e),'-h']);cliArgs['some'](_0x2f30cd=>VERSION_FLAGS[a0_0x28086a(0x122)](_0x2f30cd))&&(console[a0_0x28086a(0x165)](a0_0x28086a(0xaa)+getPackageVersion()),process[a0_0x28086a(0xe7)](0x0));cliArgs[a0_0x28086a(0x13b)](_0x20c2ea=>HELP_FLAGS[a0_0x28086a(0x122)](_0x20c2ea))&&(printHelp(),process[a0_0x28086a(0xe7)](0x0));function getCliArg(_0x79c2b6){const _0x33f4bb=a0_0x28086a;for(let _0x31a141=0x0;_0x31a141<cliArgs[_0x33f4bb(0x137)];_0x31a141++){const _0x27ded7=cliArgs[_0x31a141];if(_0x27ded7[_0x33f4bb(0xdf)]('--'+_0x79c2b6+'='))return _0x27ded7[_0x33f4bb(0x142)](('--'+_0x79c2b6+'=')[_0x33f4bb(0x137)]);if(_0x27ded7==='--'+_0x79c2b6&&_0x31a141+0x1<cliArgs[_0x33f4bb(0x137)])return cliArgs[_0x31a141+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x28086a(0x137)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x28086a(0x122)](arg)||HELP_FLAGS[a0_0x28086a(0x122)](arg))continue;if(arg[a0_0x28086a(0xdf)]('--api-key='))continue;if(arg===a0_0x28086a(0x98)){i++;continue;}args[a0_0x28086a(0xf5)](arg);}const WORKSPACE_ROOT=process[a0_0x28086a(0xd9)]['WORKSPACE_ROOT']||process[a0_0x28086a(0xd9)][a0_0x28086a(0x147)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x28086a(0xd9)][a0_0x28086a(0x176)]!==a0_0x28086a(0x114),MORPH_API_KEY=getCliArg(a0_0x28086a(0x19b))??process[a0_0x28086a(0xd9)]['MORPH_API_KEY'],MORPH_API_URL=process['env'][a0_0x28086a(0x118)],MORPH_LARGE_APPLY=process[a0_0x28086a(0xd9)]['MORPH_LARGE_APPLY']!==a0_0x28086a(0x114),MORPH_WARP_GREP_TIMEOUT=process[a0_0x28086a(0xd9)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process['env'][a0_0x28086a(0xe4)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x28086a(0xd9)][a0_0x28086a(0x14f)]?new Set(process[a0_0x28086a(0xd9)][a0_0x28086a(0x14f)][a0_0x28086a(0x97)](',')['map'](_0x131860=>_0x131860[a0_0x28086a(0x173)]())['filter'](_0x13f4f1=>_0x13f4f1[a0_0x28086a(0x137)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x28086a(0x162)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x28086a(0x122)](tool)&&console['error'](a0_0x28086a(0x14b)+tool+a0_0x28086a(0xc9)+[...KNOWN_TOOL_NAMES][a0_0x28086a(0xce)](',\x20'));}console['error'](a0_0x28086a(0x85)+[...DISABLED_TOOLS][a0_0x28086a(0xce)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x28086a(0x10f))&&!MORPH_API_KEY[a0_0x28086a(0xdf)](a0_0x28086a(0xff))&&logMcpStderr(a0_0x28086a(0xeb));async function reportMorphError(_0x4c53ae){const _0x3f3f75=a0_0x28086a;try{await a0_0x2053fa['post'](_0x3f3f75(0x14e),{..._0x4c53ae,'timestamp':new Date()[_0x3f3f75(0x18d)](),'source':_0x4c53ae['source']||_0x3f3f75(0x193),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x4c53ae[_0x3f3f75(0xda)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x3f3f75(0x10e),'Authorization':_0x3f3f75(0x161)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x1c3c50,_0x119224){const _0x430517=a0_0x28086a;if(_0x1c3c50&&typeof _0x1c3c50==='object'&&_0x430517(0x18f)in _0x1c3c50)return _0x1c3c50[_0x430517(0x18f)];if(_0x1c3c50&&typeof _0x1c3c50==='object'&&_0x430517(0xa2)in _0x1c3c50)return _0x1c3c50['response']?.[_0x430517(0x18f)];const _0x19f379=_0x119224[_0x430517(0x10a)](/\b(401|429)\b/);return _0x19f379?parseInt(_0x19f379[0x1],0xa):null;}function handleMorphAPIError(_0x50746d){const _0x417c09=a0_0x28086a,_0x40d0fc=_0x50746d instanceof Error?_0x50746d['message']:String(_0x50746d),_0x433f9e=extractStatusCode(_0x50746d,_0x40d0fc);switch(_0x433f9e){case 0x191:return{'content':[{'type':_0x417c09(0xc0),'text':_0x417c09(0xb1)}],'isError':!![]};case 0x1ad:return{'content':[{'type':'text','text':_0x417c09(0x159)}],'isError':!![]};default:return null;}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x28086a(0x125)),logMcpStderr(a0_0x28086a(0x1aa)),logMcpStderr(a0_0x28086a(0x141)),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x259695){return a0_0x577282['normalize'](_0x259695);}function expandHome(_0x3bd40f){const _0x5a5133=a0_0x28086a;if(_0x3bd40f[_0x5a5133(0xdf)]('~/')||_0x3bd40f==='~')return a0_0x577282[_0x5a5133(0xce)](a0_0x37efbe['homedir'](),_0x3bd40f['slice'](0x1));return _0x3bd40f;}let allowedDirectories=await Promise[a0_0x28086a(0x15c)](args[a0_0x28086a(0xe6)](async _0xc65a2d=>{const _0x22e9da=a0_0x28086a,_0x475733=expandHome(_0xc65a2d),_0x383e44=a0_0x577282[_0x22e9da(0x104)](_0x475733);try{const _0x56d30b=await a0_0x528ac2[_0x22e9da(0xef)](_0x383e44);return normalizePath(_0x56d30b);}catch(_0x25070b){return normalizePath(_0x383e44);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x28086a(0x137)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x28086a(0xf5)](workspaceDir),logMcpStderr('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+a0_0x28086a(0x11e)));}catch(a0_0x5573bc){logMcpStderr(a0_0x28086a(0xe9)+a0_0x5573bc);}async function detectWorkspaceRoot(_0x34c656){const _0x5bc843=a0_0x28086a;let _0x2fe5d5=a0_0x577282['resolve'](_0x34c656);const _0xca3b20=['.git',_0x5bc843(0x19e),_0x5bc843(0x82),_0x5bc843(0x8a),_0x5bc843(0x10b),_0x5bc843(0xa0),_0x5bc843(0x90),_0x5bc843(0x81),_0x5bc843(0xcf)];while(_0x2fe5d5!==a0_0x577282[_0x5bc843(0x7e)](_0x2fe5d5)){for(const _0x57c345 of _0xca3b20){const _0xc5e7a=a0_0x577282[_0x5bc843(0xce)](_0x2fe5d5,_0x57c345);try{return await a0_0x528ac2[_0x5bc843(0x18e)](_0xc5e7a),normalizePath(_0x2fe5d5);}catch{}}_0x2fe5d5=a0_0x577282[_0x5bc843(0x7e)](_0x2fe5d5);}return normalizePath(_0x34c656);}await Promise[a0_0x28086a(0x15c)](args[a0_0x28086a(0xe6)](async _0x2644c1=>{const _0x2e745c=a0_0x28086a;try{const _0x1213af=await a0_0x528ac2[_0x2e745c(0xbe)](expandHome(_0x2644c1));!_0x1213af[_0x2e745c(0x130)]()&&(logMcpStderr(_0x2e745c(0xfa)+_0x2644c1+_0x2e745c(0x102)),process['exit'](0x1));}catch(_0x26fc17){logMcpStderr(_0x2e745c(0x133)+_0x2644c1+':',_0x26fc17),process[_0x2e745c(0xe7)](0x1);}}));async function validatePath(_0x5677cb){const _0x494f89=a0_0x28086a,_0x2477bd=expandHome(_0x5677cb),_0x320723=a0_0x577282[_0x494f89(0x104)](_0x2477bd);logger[_0x494f89(0x163)](_0x494f89(0x14a),_0x494f89(0xb8),{'raw_path':_0x5677cb,'absolute':_0x320723});try{const _0x224ddf=await a0_0x528ac2[_0x494f89(0xef)](_0x320723);return logger[_0x494f89(0x163)](_0x494f89(0x14a),'path_validation_resolved',{'resolved':_0x224ddf,'symlink':_0x224ddf!==_0x320723}),_0x224ddf;}catch(_0x403644){if(_0x403644[_0x494f89(0x83)]==='ENOENT'){const _0x5de685=a0_0x577282[_0x494f89(0x7e)](_0x320723);try{const _0x4a834e=await a0_0x528ac2[_0x494f89(0xef)](_0x5de685),_0x129fe9=a0_0x577282[_0x494f89(0xce)](_0x4a834e,a0_0x577282[_0x494f89(0x13c)](_0x320723));return logger[_0x494f89(0x163)](_0x494f89(0x14a),_0x494f89(0x13e),{'resolved':_0x129fe9,'new_file':!![]}),_0x129fe9;}catch{logger[_0x494f89(0x7c)](_0x494f89(0x14a),'path_validation_failed',{'raw_path':_0x5677cb,'error':_0x494f89(0xa6)+_0x5de685});throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x5de685);}}logger['error'](_0x494f89(0x14a),_0x494f89(0xad),{'raw_path':_0x5677cb,'error':_0x403644['message']});throw _0x403644;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x28086a(0x100)](),'code_edit':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x87)](a0_0x28086a(0x184)),'instruction':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x87)](a0_0x28086a(0x115)),'dryRun':z[a0_0x28086a(0x99)]()['default'](![])[a0_0x28086a(0x87)]('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x28086a(0x1a8),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x87)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x87)](a0_0x28086a(0x108)),'search_type':z[a0_0x28086a(0x172)]([a0_0x28086a(0x181),'node_modules'])['optional']()['describe'](a0_0x28086a(0x192))}),WarpGrepGitHubArgsSchema=z[a0_0x28086a(0xac)]({'search_string':z['string']()[a0_0x28086a(0x87)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()['optional']()[a0_0x28086a(0x87)](a0_0x28086a(0x185)),'owner_repo':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x107)]()['describe'](a0_0x28086a(0x16b)),'branch':z[a0_0x28086a(0x100)]()['optional']()[a0_0x28086a(0x87)](a0_0x28086a(0xa5))}),CodebaseSearchArgsSchema=z['object']({'query':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x87)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()[a0_0x28086a(0x87)](a0_0x28086a(0x12d)),'branch':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x107)]()['describe']('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x107)]()[a0_0x28086a(0x87)](a0_0x28086a(0x16d)),'targetDirectories':z[a0_0x28086a(0x112)](z[a0_0x28086a(0x100)]())[a0_0x28086a(0x181)]([])[a0_0x28086a(0x87)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z['number']()[a0_0x28086a(0x107)]()[a0_0x28086a(0x181)](0xa)['describe'](a0_0x28086a(0x12f))}),server=new Server({'name':a0_0x28086a(0x11a),'version':a0_0x28086a(0xa3)},{'capabilities':{'tools':{}}});server[a0_0x28086a(0x155)](ListToolsRequestSchema,async()=>{const _0x449ce6=a0_0x28086a,_0x3807de=[{'name':TOOL_NAMES[_0x449ce6(0x149)],'description':_0x449ce6(0x164)+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+_0x449ce6(0x11f)+_0x449ce6(0x199)+'Benefits:\x0a'+_0x449ce6(0x189)+_0x449ce6(0x94)+_0x449ce6(0xcd)+_0x449ce6(0x1a0)+_0x449ce6(0xf7)+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+_0x449ce6(0xdc)+_0x449ce6(0x150)+_0x449ce6(0xe0)+_0x449ce6(0xdd)+_0x449ce6(0x188)+_0x449ce6(0x156)+'-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a'+_0x449ce6(0x18c)+_0x449ce6(0x17c)+_0x449ce6(0x93)+_0x449ce6(0x18a)+'IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x449ce6(0xc6)],'description':_0x449ce6(0x17b)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x449ce6(0x19d)+_0x449ce6(0xc2)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x492a61=_0x3807de['filter'](_0x36d560=>{const _0x2c6513=_0x449ce6;if(DISABLED_TOOLS[_0x2c6513(0x122)](_0x36d560['name']))return console['error']('Tool\x20'+_0x36d560[_0x2c6513(0xae)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if('requiresApiKey'in _0x36d560&&_0x36d560[_0x2c6513(0xd3)]&&!MORPH_API_KEY)return logMcpStderr(_0x2c6513(0xd2)+_0x36d560[_0x2c6513(0xae)]+_0x2c6513(0xc1)),![];return!![];});return{'tools':_0x492a61[_0x449ce6(0xe6)](_0x270e9c=>({'name':_0x270e9c[_0x449ce6(0xae)],'description':_0x270e9c['description'],'inputSchema':_0x270e9c[_0x449ce6(0x1a6)]}))};}),server[a0_0x28086a(0x155)](CallToolRequestSchema,async _0x21974f=>{const _0x3ee2c5=a0_0x28086a,{name:_0x2f0d2e,arguments:_0x3cada3}=_0x21974f['params'],_0x33afa6=Date[_0x3ee2c5(0x182)]();logger[_0x3ee2c5(0x163)](_0x3ee2c5(0x14a),_0x3ee2c5(0x116),{'tool':_0x2f0d2e,'args':_0x2f0d2e===_0x3ee2c5(0x18b)?{'path':_0x3cada3?.[_0x3ee2c5(0xe5)],'instruction':_0x3cada3?.[_0x3ee2c5(0x146)]||_0x3cada3?.[_0x3ee2c5(0x13a)],'dryRun':_0x3cada3?.[_0x3ee2c5(0x17a)]}:_0x3cada3});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x3ee2c5(0xc0),'text':_0x3ee2c5(0xcc)}],'isError':!![]};if(!MORPH_API_KEY[_0x3ee2c5(0xdf)](_0x3ee2c5(0x10f))&&!MORPH_API_KEY['startsWith'](_0x3ee2c5(0xff)))return{'content':[{'type':_0x3ee2c5(0xc0),'text':_0x3ee2c5(0xea)}],'isError':!![]};if(DISABLED_TOOLS[_0x3ee2c5(0x122)](_0x2f0d2e))return{'content':[{'type':_0x3ee2c5(0xc0),'text':_0x3ee2c5(0x131)+_0x2f0d2e+_0x3ee2c5(0x13d)}],'isError':![]};switch(_0x2f0d2e){case TOOL_NAMES[_0x3ee2c5(0x149)]:{let _0x237ecc=_0x3cada3;if(_0x237ecc&&typeof _0x237ecc===_0x3ee2c5(0xac)){if(!('path'in _0x237ecc)){const _0x13d94d=_0x237ecc[_0x3ee2c5(0x16e)]??_0x237ecc[_0x3ee2c5(0xd1)]??_0x237ecc[_0x3ee2c5(0x190)]??_0x237ecc[_0x3ee2c5(0x1a4)]??_0x237ecc['file'];if(_0x13d94d)_0x237ecc={..._0x237ecc,'path':_0x13d94d};}_0x3ee2c5(0x13a)in _0x237ecc&&!(_0x3ee2c5(0x146)in _0x237ecc)&&(_0x237ecc={..._0x237ecc,'instruction':_0x237ecc[_0x3ee2c5(0x13a)]});if(!(_0x3ee2c5(0x7b)in _0x237ecc)){const _0x250252=_0x237ecc[_0x3ee2c5(0x83)]??_0x237ecc[_0x3ee2c5(0x9f)]??_0x237ecc['content']??_0x237ecc[_0x3ee2c5(0xca)];if(_0x250252)_0x237ecc={..._0x237ecc,'code_edit':_0x250252};}}const _0x2340a0=MorphEditFileArgsSchema[_0x3ee2c5(0x198)](_0x237ecc);if(!_0x2340a0[_0x3ee2c5(0x15b)])throw new Error(_0x3ee2c5(0xb0)+_0x2340a0['error']);const _0x257171=await validatePath(_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0xe5)]);let _0x4658b2=null,_0x3fa080=!![],_0x1ce2b=null;try{_0x4658b2=await a0_0x528ac2['readFile'](_0x257171,_0x3ee2c5(0xe3)),logger[_0x3ee2c5(0x163)](_0x3ee2c5(0x14a),_0x3ee2c5(0x9b),{'path':_0x257171,'size_bytes':_0x4658b2['length']});}catch(_0x569a22){const _0x3af43b=_0x569a22[_0x3ee2c5(0x83)];_0x3af43b===_0x3ee2c5(0x129)?(_0x3fa080=![],_0x4658b2='',logger[_0x3ee2c5(0x163)](_0x3ee2c5(0x14a),_0x3ee2c5(0x9b),{'path':_0x257171,'exists':![]})):(_0x1ce2b='Failed\x20to\x20read\x20file:\x20'+(_0x3af43b||'unknown')+_0x3ee2c5(0x197)+(_0x569a22 instanceof Error?_0x569a22['message']:String(_0x569a22)),logger[_0x3ee2c5(0x7c)](_0x3ee2c5(0x14a),'file_read_failed',{'path':_0x257171,'error':_0x1ce2b}),logMcpStderr('Warning:\x20'+_0x1ce2b));}let _0xbbd104;try{const _0x1ff86a=MORPH_API_KEY;if(!_0x1ff86a)throw new Error(_0x3ee2c5(0xd0));const _0x963f0d=a0_0x577282[_0x3ee2c5(0x7e)](_0x257171),_0xd8f9cd=a0_0x577282[_0x3ee2c5(0x13c)](_0x257171);logger[_0x3ee2c5(0x163)](_0x3ee2c5(0x14a),_0x3ee2c5(0x145),{'model':_0x3ee2c5(0x8d),'path':_0x2340a0[_0x3ee2c5(0x17f)]['path'],'instruction_len':_0x2340a0[_0x3ee2c5(0x17f)]['instruction'][_0x3ee2c5(0x137)],'code_edit_len':_0x2340a0['data'][_0x3ee2c5(0x7b)][_0x3ee2c5(0x137)],'original_code_len':_0x4658b2?.[_0x3ee2c5(0x137)]??0x0,'dry_run':_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x17a)]});const _0x5186c9=Date[_0x3ee2c5(0x182)](),_0x5e44f0=await executeEditFile({'target_filepath':_0xd8f9cd,'code_edit':_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x7b)],'instruction':_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x146)]},{'morphApiKey':_0x1ff86a,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x963f0d,'autoWrite':!_0x2340a0[_0x3ee2c5(0x17f)]['dryRun'],'generateUdiff':![],'debug':![]}),_0x31aa54=Date['now']()-_0x5186c9;_0xbbd104=_0x5e44f0[_0x3ee2c5(0x169)];if(!_0x5e44f0['success'])throw new Error(_0x5e44f0['error']||_0x3ee2c5(0xd4));const _0x508171=_0x5e44f0['changes'],_0x4567c2=_0x3ee2c5(0x123)+_0x508171[_0x3ee2c5(0x92)]+',\x20removed\x20'+_0x508171[_0x3ee2c5(0x120)]+',\x20modified\x20'+_0x508171['linesModified'];logger[_0x3ee2c5(0x163)](_0x3ee2c5(0x14a),'tool_call_complete',{'tool':_0x3ee2c5(0x18b),'success':!![],'latency_ms':Date['now']()-_0x33afa6,'edit_latency_ms':_0x31aa54,'changes':{'added':_0x508171[_0x3ee2c5(0x92)],'removed':_0x508171['linesRemoved'],'modified':_0x508171[_0x3ee2c5(0x101)]},'completion_id':_0xbbd104});if(_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x17a)])return{'content':[{'type':_0x3ee2c5(0xc0),'text':'Morph\x20Edit\x20Preview'+(_0x3fa080?'':_0x3ee2c5(0x7f))+':\x20'+_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x146)]+_0x3ee2c5(0x119)+_0x4567c2+_0x3ee2c5(0x11b)+_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0xe5)]+'.'}]};return{'content':[{'type':_0x3ee2c5(0xc0),'text':_0x3ee2c5(0xed)+(_0x3fa080?'Applied':_0x3ee2c5(0x8c))+':\x20'+_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x146)]+'.\x20Changes:\x20'+_0x4567c2+_0x3ee2c5(0x11b)+_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0xe5)]+'.'}]};}catch(_0x379b7f){const _0x37cb29=handleMorphAPIError(_0x379b7f);if(_0x37cb29)return logger[_0x3ee2c5(0x7c)](_0x3ee2c5(0x14a),_0x3ee2c5(0xb9),{'tool':_0x3ee2c5(0x18b),'error':_0x3ee2c5(0x15d),'latency_ms':Date[_0x3ee2c5(0x182)]()-_0x33afa6}),_0x37cb29;const _0x587d99=_0x379b7f instanceof Error?_0x379b7f['message']:String(_0x379b7f);return logger[_0x3ee2c5(0x7c)]('MCP','tool_call_error',{'tool':_0x3ee2c5(0x18b),'error':_0x587d99,'path':_0x2340a0[_0x3ee2c5(0x17f)]['path'],'validated_path':_0x257171,'latency_ms':Date[_0x3ee2c5(0x182)]()-_0x33afa6,'stack':_0x379b7f instanceof Error?_0x379b7f[_0x3ee2c5(0xfb)]:undefined}),reportMorphError({'error_message':_0x587d99,'error_type':_0x379b7f instanceof Error?_0x379b7f['constructor']['name']:_0x3ee2c5(0xb5),'context':{'tool':_0x3ee2c5(0x18b),'completion_id':_0xbbd104,'file_path':_0x2340a0['data'][_0x3ee2c5(0xe5)],'validated_path':_0x257171,'instruction':_0x2340a0['data'][_0x3ee2c5(0x146)],'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x3ee2c5(0x8d),'dry_run':_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x17a)],'file_exists':_0x3fa080,'file_read_error':_0x1ce2b,'file_readable':_0x4658b2!==null,'request_content':{'path':_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0xe5)],'code_edit':_0x2340a0[_0x3ee2c5(0x17f)]['code_edit'],'instruction':_0x2340a0[_0x3ee2c5(0x17f)]['instruction'],'original_code':_0x4658b2!==null?_0x4658b2[_0x3ee2c5(0x137)]>0xc350?_0x4658b2[_0x3ee2c5(0x91)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x4658b2[_0x3ee2c5(0x137)]+_0x3ee2c5(0xf6):_0x4658b2:'[could\x20not\x20read\x20file:\x20'+(_0x1ce2b||'unknown\x20error')+']','original_code_length':_0x4658b2?.['length']??0x0,'model':MORPH_LARGE_APPLY?_0x3ee2c5(0x166):_0x3ee2c5(0x8d),'dry_run':_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x17a)]}},'stack_trace':_0x379b7f instanceof Error?_0x379b7f['stack']:undefined,'source':_0x3ee2c5(0x193)})[_0x3ee2c5(0x9d)](()=>{}),{'content':[{'type':'text','text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x587d99}],'isError':!![]};}}case TOOL_NAMES[_0x3ee2c5(0xc6)]:{const _0xbf9ecd=WarpGrepArgsSchema[_0x3ee2c5(0x198)](_0x3cada3);if(!_0xbf9ecd[_0x3ee2c5(0x15b)])return{'content':[{'type':_0x3ee2c5(0xc0),'text':'Invalid\x20arguments:\x20'+_0xbf9ecd['error']}],'isError':!![]};const _0x325921=_0x40d67d=>{const _0x33b72a=_0x3ee2c5,_0x99752b=[];for(const _0x12159b of _0x40d67d||[]){if(_0x12159b[_0x33b72a(0x136)]===_0x33b72a(0x12a)&&Array[_0x33b72a(0xf2)](_0x12159b[_0x33b72a(0x151)]))for(const _0x2aabb9 of _0x12159b[_0x33b72a(0x151)]){try{const _0x208805=_0x2aabb9[_0x33b72a(0x144)]?.[_0x33b72a(0xae)],_0x13c455=JSON[_0x33b72a(0x12c)](_0x2aabb9[_0x33b72a(0x144)]?.[_0x33b72a(0xf8)]||'{}');if(_0x208805===_0x33b72a(0x154))_0x99752b[_0x33b72a(0xf5)](_0x33b72a(0xfc)+_0x13c455['pattern']+'\x27\x20'+(_0x13c455[_0x33b72a(0xe5)]||'.'));else{if(_0x208805===_0x33b72a(0x88))_0x99752b[_0x33b72a(0xf5)]('read\x20'+_0x13c455[_0x33b72a(0xe5)]);else{if(_0x208805==='list_directory')_0x99752b['push'](_0x33b72a(0x110)+(_0x13c455[_0x33b72a(0x194)]||'.'));else{if(_0x208805==='glob')_0x99752b[_0x33b72a(0xf5)](_0x33b72a(0x183)+_0x13c455['pattern']+'\x27\x20'+(_0x13c455['path']||'.'));else _0x208805===_0x33b72a(0xfd)&&_0x99752b[_0x33b72a(0xf5)]('finish');}}}}catch{}}}return _0x99752b;},_0x19c467=_0x373c7b=>{const _0x20dd0c=_0x3ee2c5,_0x15efee=[];if(!_0x373c7b||!Array['isArray'](_0x373c7b))return _0x15efee;const _0x14145b=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x20dd0c(0x15f),'tool':_0x20dd0c(0x88)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x20dd0c(0x9e),'tool':_0x20dd0c(0x88)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x20dd0c(0x8e),'tool':_0x20dd0c(0x88)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x20dd0c(0x191),'tool':_0x20dd0c(0x117)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x20dd0c(0xc7),'tool':_0x20dd0c(0x117)},{'pattern':/\[BINARY FILE\]/,'error_type':'BinaryFile','tool':_0x20dd0c(0x88)},{'pattern':/\[SYMLINK\]/,'error_type':_0x20dd0c(0xa7),'tool':_0x20dd0c(0x88)},{'pattern':/not a text file/,'error_type':_0x20dd0c(0x8e),'tool':'read'},{'pattern':/symbolic link/,'error_type':_0x20dd0c(0xa7),'tool':_0x20dd0c(0x88)},{'pattern':/Error reading file:/,'error_type':_0x20dd0c(0x9e),'tool':_0x20dd0c(0x88)},{'pattern':/status="error"/,'error_type':_0x20dd0c(0xf0),'tool':'unknown'}];let _0x51139c=0x0;for(const _0x5b1fb5 of _0x373c7b){_0x5b1fb5[_0x20dd0c(0x136)]===_0x20dd0c(0x12a)&&Array[_0x20dd0c(0xf2)](_0x5b1fb5[_0x20dd0c(0x151)])&&_0x51139c++;const _0xa6c57e=_0x5b1fb5[_0x20dd0c(0xaf)];if((_0x5b1fb5[_0x20dd0c(0x136)]===_0x20dd0c(0xb6)||_0x5b1fb5[_0x20dd0c(0x136)]===_0x20dd0c(0x96))&&_0xa6c57e&&typeof _0xa6c57e===_0x20dd0c(0x100))for(const {pattern:_0x4494fa,error_type:_0x3ba715,tool:_0x3e534f}of _0x14145b){const _0x1e4d19=_0xa6c57e[_0x20dd0c(0x10a)](new RegExp(_0x4494fa['source'],'g'));if(_0x1e4d19)for(const _0x73ad11 of _0x1e4d19){const _0x96554c=_0xa6c57e[_0x20dd0c(0x109)](_0x73ad11),_0x8f1c76=_0xa6c57e[_0x20dd0c(0x91)](_0x96554c,Math['min'](_0x96554c+0xc8,_0xa6c57e[_0x20dd0c(0x137)]));_0x15efee[_0x20dd0c(0xf5)]({'tool':_0x3e534f,'error_type':_0x3ba715,'error_message':_0x8f1c76[_0x20dd0c(0x97)]('\x0a')[0x0],'turn':_0x51139c});}}}return _0x15efee;};try{const _0x1d0d35=a0_0x577282['resolve'](_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x160)]),_0x5330a5=_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x152)],_0xba65f3=_0x5330a5==='node_modules'?{'allowNames':[_0x3ee2c5(0x8b)]}:undefined,_0x108fd8=new LocalRipgrepProvider(_0x1d0d35,undefined,_0xba65f3);logger[_0x3ee2c5(0x163)](_0x3ee2c5(0x14a),_0x3ee2c5(0xb2),{'type':_0x3ee2c5(0x124),'repo_root':_0x1d0d35,'search_type':_0x5330a5||_0x3ee2c5(0x181)}),logger[_0x3ee2c5(0x163)]('MCP',_0x3ee2c5(0x178),{'query':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x143)],'repo_root':_0x1d0d35,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x1316cc=Date[_0x3ee2c5(0x182)](),_0x5eb3e2=await runWarpGrep({'searchTerm':_0xbf9ecd['data'][_0x3ee2c5(0x143)],'repoRoot':_0x1d0d35,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x108fd8,'search_type':_0x5330a5}),_0x2b756e=Date[_0x3ee2c5(0x182)]()-_0x1316cc,_0x3a98aa=_0x5eb3e2[_0x3ee2c5(0xfd)]?.[_0x3ee2c5(0x9c)]?.[_0x3ee2c5(0x103)]?.[_0x3ee2c5(0x137)]??0x0;logger[_0x3ee2c5(0x163)]('MCP',_0x3ee2c5(0x89),{'termination':_0x5eb3e2[_0x3ee2c5(0x106)],'turns':_0x5eb3e2['timings']?.[_0x3ee2c5(0xee)]??0x0,'files_found':_0x3a98aa,'latency_ms':_0x2b756e});const _0x11f3c9=_0x19c467(_0x5eb3e2[_0x3ee2c5(0x158)]);_0x11f3c9['length']>0x0&&reportMorphError({'error_message':_0x3ee2c5(0x12e)+_0x11f3c9[_0x3ee2c5(0x137)]+_0x3ee2c5(0x16c),'error_type':_0x3ee2c5(0x1a7),'level':_0x3ee2c5(0x11d),'tool':_0x3ee2c5(0x95),'context':{'repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)]['repo_path'],'query':_0xbf9ecd['data']['search_string'],'model':_0x3ee2c5(0x12b),'termination_reason':_0x5eb3e2[_0x3ee2c5(0x106)],'sub_tool_errors':_0x11f3c9,'timings':_0x5eb3e2[_0x3ee2c5(0xf4)],'tool_calls':_0x325921(_0x5eb3e2[_0x3ee2c5(0x158)]),'messages':_0x5eb3e2['messages']?.[_0x3ee2c5(0xe6)](_0x4efd9a=>({'role':_0x4efd9a[_0x3ee2c5(0x136)],'content':_0x4efd9a[_0x3ee2c5(0xaf)],..._0x4efd9a['tool_calls']?{'tool_calls':_0x4efd9a['tool_calls']['length']}:{},..._0x4efd9a[_0x3ee2c5(0xe2)]?{'tool_call_id':_0x4efd9a['tool_call_id']}:{}}))},'source':_0x3ee2c5(0x193)})[_0x3ee2c5(0x9d)](()=>{});let _0x31327c='';if(_0x5eb3e2['terminationReason']==='completed'&&_0x5eb3e2[_0x3ee2c5(0xfd)]?.[_0x3ee2c5(0x9c)]?.[_0x3ee2c5(0x103)]){const _0x2047b5=_0x5eb3e2['finish']['metadata'][_0x3ee2c5(0x103)];if(_0x2047b5[_0x3ee2c5(0x137)]===0x0)return _0x31327c=_0x5eb3e2[_0x3ee2c5(0xfd)][_0x3ee2c5(0x157)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x3ee2c5(0xc0),'text':_0x31327c}]};const _0x41e3d7=[],_0x39e67c=[_0x3ee2c5(0xab)];for(const _0x15e3da of _0x5eb3e2[_0x3ee2c5(0x158)]){if(_0x15e3da[_0x3ee2c5(0x136)]==='assistant'&&Array[_0x3ee2c5(0xf2)](_0x15e3da[_0x3ee2c5(0x151)]))for(const _0x102fca of _0x15e3da['tool_calls']){try{const _0x37604a=_0x102fca['function']?.['name'],_0x23cfac=JSON['parse'](_0x102fca[_0x3ee2c5(0x144)]?.[_0x3ee2c5(0xf8)]||'{}');if(_0x37604a===_0x3ee2c5(0x154))_0x39e67c[_0x3ee2c5(0xf5)](_0x3ee2c5(0xa4)+_0x23cfac[_0x3ee2c5(0xbf)]+_0x3ee2c5(0xdb)+(_0x23cfac['path']||'.')+'`');else{if(_0x37604a===_0x3ee2c5(0x88))_0x39e67c[_0x3ee2c5(0xf5)](_0x3ee2c5(0x174)+_0x23cfac['path']+'`');else{if(_0x37604a==='list_directory')_0x39e67c[_0x3ee2c5(0xf5)]('-\x20Listed\x20directory\x20`'+(_0x23cfac['command']||'.')+'`');else _0x37604a==='glob'&&_0x39e67c['push']('-\x20Glob\x20search\x20`'+_0x23cfac[_0x3ee2c5(0xbf)]+'`\x20in\x20`'+(_0x23cfac['path']||'.')+'`');}}}catch{}}}_0x41e3d7[_0x3ee2c5(0xf5)](_0x39e67c['join']('\x0a'));const _0x2784f0=['','Relevant\x20context\x20found:'];for(const _0x21a0cf of _0x2047b5){if(_0x21a0cf[_0x3ee2c5(0x17e)]==='*')_0x2784f0[_0x3ee2c5(0xf5)]('-\x20'+_0x21a0cf[_0x3ee2c5(0xe5)]+':*');else{if(Array['isArray'](_0x21a0cf[_0x3ee2c5(0x17e)])){const _0x36b1d8=_0x21a0cf[_0x3ee2c5(0x17e)]['map'](([_0x322eb1,_0x42eaa8])=>{if(_0x322eb1===_0x42eaa8)return''+_0x322eb1;return _0x322eb1+'-'+_0x42eaa8;});_0x2784f0[_0x3ee2c5(0xf5)]('-\x20'+_0x21a0cf[_0x3ee2c5(0xe5)]+':'+_0x36b1d8[_0x3ee2c5(0xce)](','));}else _0x2784f0[_0x3ee2c5(0xf5)]('-\x20'+_0x21a0cf[_0x3ee2c5(0xe5)]+':*');}}_0x2784f0[_0x3ee2c5(0xf5)](''),_0x41e3d7[_0x3ee2c5(0xf5)](_0x2784f0[_0x3ee2c5(0xce)]('\x0a')),_0x41e3d7[_0x3ee2c5(0xf5)](_0x3ee2c5(0x16f));const _0x4322e1=[],_0x1737da=[];for(const _0x10e6b4 of _0x2047b5){let _0x59efaf=a0_0x577282['resolve'](_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x160)],_0x10e6b4[_0x3ee2c5(0xe5)]),_0x436f17=null,_0xa683a2=null;try{_0x436f17=await a0_0x528ac2[_0x3ee2c5(0xbb)](_0x59efaf,{'encoding':_0x3ee2c5(0xe3)});}catch(_0x2b59dd){const _0x519419=fixPathRepetition(_0x59efaf);if(_0x519419)try{_0x436f17=await a0_0x528ac2[_0x3ee2c5(0xbb)](_0x519419,{'encoding':'utf-8'}),_0x59efaf=_0x519419;}catch{_0xa683a2=_0x2b59dd instanceof Error?_0x2b59dd:new Error(String(_0x2b59dd));}else _0xa683a2=_0x2b59dd instanceof Error?_0x2b59dd:new Error(String(_0x2b59dd));}if(_0x436f17!==null){const _0x3994f9=_0x436f17['split'](/\r?\n/),_0xa750b4=[];if(_0x10e6b4[_0x3ee2c5(0x17e)]==='*'||!Array[_0x3ee2c5(0xf2)](_0x10e6b4[_0x3ee2c5(0x17e)]))for(let _0x2cb4f2=0x1;_0x2cb4f2<=_0x3994f9[_0x3ee2c5(0x137)];_0x2cb4f2++){const _0x853b6b=_0x3994f9[_0x2cb4f2-0x1];_0xa750b4[_0x3ee2c5(0xf5)](_0x2cb4f2+'|\x20'+_0x853b6b);}else for(const [_0x1785ac,_0x576de2]of _0x10e6b4[_0x3ee2c5(0x17e)]){_0xa750b4[_0x3ee2c5(0x137)]>0x0&&_0xa750b4[_0x3ee2c5(0xf5)]('');for(let _0x2cac9d=_0x1785ac;_0x2cac9d<=_0x576de2&&_0x2cac9d<=_0x3994f9['length'];_0x2cac9d++){const _0x158df8=_0x3994f9[_0x2cac9d-0x1];_0xa750b4[_0x3ee2c5(0xf5)](_0x2cac9d+'|\x20'+_0x158df8);}}_0x1737da['push']({'path':_0x10e6b4['path'],'content':_0xa750b4[_0x3ee2c5(0xce)]('\x0a')});}else _0x4322e1[_0x3ee2c5(0xf5)](_0x3ee2c5(0xb3)+_0x10e6b4[_0x3ee2c5(0xe5)]+_0x3ee2c5(0x135)+(_0xa683a2?.[_0x3ee2c5(0xa1)]||_0x3ee2c5(0xc5))+_0x3ee2c5(0xb4));}try{const _0x3e06bd=await compactFileContexts(_0x1737da,_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x143)],MORPH_API_KEY,MORPH_API_URL);for(const _0x3b5a99 of _0x3e06bd){_0x4322e1[_0x3ee2c5(0xf5)](_0x3ee2c5(0xb3)+_0x3b5a99[_0x3ee2c5(0xe5)]+_0x3ee2c5(0x195)+_0x3b5a99[_0x3ee2c5(0xaf)]+_0x3ee2c5(0xb4));}}catch(_0x3d30b5){logger[_0x3ee2c5(0x11d)](_0x3ee2c5(0x14a),'compaction_failed',{'error':_0x3d30b5 instanceof Error?_0x3d30b5[_0x3ee2c5(0xa1)]:String(_0x3d30b5),'files_count':_0x1737da['length']});for(const _0x54c0dd of _0x1737da){_0x4322e1[_0x3ee2c5(0xf5)](_0x3ee2c5(0xb3)+_0x54c0dd[_0x3ee2c5(0xe5)]+_0x3ee2c5(0x195)+_0x54c0dd['content']+_0x3ee2c5(0xb4));}}_0x41e3d7[_0x3ee2c5(0xf5)](_0x4322e1['join']('\x0a\x0a')),_0x31327c=_0x41e3d7[_0x3ee2c5(0xce)]('\x0a');const _0x52cfa0=_0x5eb3e2[_0x3ee2c5(0x19f)]?.['filter'](_0x31c893=>_0x31c893[_0x3ee2c5(0xa1)]?.[_0x3ee2c5(0xdf)](_0x3ee2c5(0x10d)))||[];if(_0x52cfa0[_0x3ee2c5(0x137)]>0x0){const _0x2eeea7=_0x52cfa0[_0x3ee2c5(0xe6)](_0x52bd37=>_0x52bd37[_0x3ee2c5(0xa1)])[_0x3ee2c5(0xce)](';\x20');reportMorphError({'error_message':_0x2eeea7,'error_type':_0x3ee2c5(0x171),'context':{'tool':'codebase_search','repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x160)],'query':_0xbf9ecd[_0x3ee2c5(0x17f)]['search_string'],'model':_0x3ee2c5(0x12b),'termination_reason':_0x3ee2c5(0x167),'error_count':_0x52cfa0['length'],'is_timeout':![],'timings':_0x5eb3e2['timings'],'files_attempted':_0x2047b5[_0x3ee2c5(0xe6)](_0x2dcc8c=>({'path':_0x2dcc8c[_0x3ee2c5(0xe5)],'lines':_0x2dcc8c[_0x3ee2c5(0x17e)]})),'tool_calls':_0x325921(_0x5eb3e2[_0x3ee2c5(0x158)]),'messages':_0x5eb3e2['messages']?.[_0x3ee2c5(0xe6)](_0x39ab56=>({'role':_0x39ab56[_0x3ee2c5(0x136)],'content':_0x39ab56[_0x3ee2c5(0xaf)],..._0x39ab56[_0x3ee2c5(0x151)]?{'tool_calls':_0x39ab56[_0x3ee2c5(0x151)][_0x3ee2c5(0x137)]}:{},..._0x39ab56[_0x3ee2c5(0xe2)]?{'tool_call_id':_0x39ab56[_0x3ee2c5(0xe2)]}:{}})),'request_content':{'query':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x143)],'repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)]['repo_path'],'repoRoot':a0_0x577282[_0x3ee2c5(0x104)](_0xbf9ecd['data']['repo_path']),'model':_0x3ee2c5(0x12b)}},'source':_0x3ee2c5(0x193)})[_0x3ee2c5(0x9d)](()=>{});}}else{if(_0x5eb3e2[_0x3ee2c5(0x106)]===_0x3ee2c5(0x13f)&&_0x5eb3e2['errors'][_0x3ee2c5(0x137)]>0x0){const _0x5a4208=_0x5eb3e2[_0x3ee2c5(0x19f)][_0x3ee2c5(0xe6)](_0x6160f7=>_0x6160f7[_0x3ee2c5(0xa1)])['join'](';\x20');_0x31327c=_0x3ee2c5(0xfa)+_0x5a4208;const _0x62a67=_0x5a4208[_0x3ee2c5(0xfe)]()[_0x3ee2c5(0xcb)](_0x3ee2c5(0xc4))||_0x5a4208['toLowerCase']()[_0x3ee2c5(0xcb)](_0x3ee2c5(0x140))||_0x5a4208[_0x3ee2c5(0xfe)]()[_0x3ee2c5(0xcb)]('etimedout'),_0x28da95=_0x5eb3e2['finish']?.[_0x3ee2c5(0x9c)]?.['files'],_0x4c4818=_0x5eb3e2['errors'][0x0];reportMorphError({'error_message':_0x5a4208,'error_type':_0x62a67?_0x3ee2c5(0x170):_0x4c4818?.['constructor']?.[_0x3ee2c5(0xae)]||'WarpGrepError','context':{'tool':_0x3ee2c5(0x95),'repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x160)],'query':_0xbf9ecd[_0x3ee2c5(0x17f)]['search_string'],'model':_0x3ee2c5(0x12b),'termination_reason':_0x5eb3e2[_0x3ee2c5(0x106)],'error_count':_0x5eb3e2[_0x3ee2c5(0x19f)][_0x3ee2c5(0x137)],'is_timeout':_0x62a67,'timings':_0x5eb3e2['timings'],'files_attempted':_0x28da95?.[_0x3ee2c5(0xe6)](_0x282512=>({'path':_0x282512[_0x3ee2c5(0xe5)],'lines':_0x282512['lines']})),'tool_calls':_0x325921(_0x5eb3e2[_0x3ee2c5(0x158)]),'messages':_0x5eb3e2[_0x3ee2c5(0x158)]?.[_0x3ee2c5(0xe6)](_0x2e3dd3=>({'role':_0x2e3dd3['role'],'content':_0x2e3dd3[_0x3ee2c5(0xaf)],..._0x2e3dd3[_0x3ee2c5(0x151)]?{'tool_calls':_0x2e3dd3['tool_calls'][_0x3ee2c5(0x137)]}:{},..._0x2e3dd3[_0x3ee2c5(0xe2)]?{'tool_call_id':_0x2e3dd3[_0x3ee2c5(0xe2)]}:{}})),'request_content':{'query':_0xbf9ecd['data']['search_string'],'repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x160)],'repoRoot':a0_0x577282['resolve'](_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x160)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x4c4818?.[_0x3ee2c5(0xfb)]||undefined,'source':_0x3ee2c5(0x193)})[_0x3ee2c5(0x9d)](()=>{});}else _0x31327c=_0x3ee2c5(0xa8);}return{'content':[{'type':_0x3ee2c5(0xc0),'text':_0x31327c}]};}catch(_0x24927e){const _0x49bba5=handleMorphAPIError(_0x24927e);if(_0x49bba5)return logger[_0x3ee2c5(0x7c)]('MCP',_0x3ee2c5(0xb9),{'tool':'codebase_search','error':_0x3ee2c5(0x15d),'latency_ms':Date[_0x3ee2c5(0x182)]()-_0x33afa6}),_0x49bba5;const _0x5ceae2=_0x24927e instanceof Error?_0x24927e[_0x3ee2c5(0xa1)]:String(_0x24927e);logger['error'](_0x3ee2c5(0x14a),'tool_call_error',{'tool':_0x3ee2c5(0x95),'error':_0x5ceae2,'repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)]['repo_path'],'query':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x143)],'latency_ms':Date[_0x3ee2c5(0x182)]()-_0x33afa6});const _0x390d68=_0x5ceae2[_0x3ee2c5(0xfe)]()[_0x3ee2c5(0xcb)](_0x3ee2c5(0xc4))||_0x5ceae2['toLowerCase']()[_0x3ee2c5(0xcb)](_0x3ee2c5(0x140))||_0x5ceae2[_0x3ee2c5(0xfe)]()[_0x3ee2c5(0xcb)]('etimedout')||_0x24927e instanceof Error&&_0x24927e[_0x3ee2c5(0xae)]===_0x3ee2c5(0x170);return reportMorphError({'error_message':_0x5ceae2,'error_type':_0x390d68?'TimeoutError':_0x24927e instanceof Error?_0x24927e['constructor'][_0x3ee2c5(0xae)]:_0x3ee2c5(0xb5),'context':{'tool':_0x3ee2c5(0x95),'repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x160)],'query':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x143)],'model':_0x3ee2c5(0x12b),'is_timeout':_0x390d68,'exception_phase':_0x3ee2c5(0x8f),'request_content':{'query':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x143)],'repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)]['repo_path'],'repoRoot':a0_0x577282[_0x3ee2c5(0x104)](_0xbf9ecd['data'][_0x3ee2c5(0x160)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x24927e instanceof Error?_0x24927e[_0x3ee2c5(0xfb)]:undefined,'source':_0x3ee2c5(0x193)})[_0x3ee2c5(0x9d)](()=>{}),{'content':[{'type':_0x3ee2c5(0xc0),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x5ceae2}],'isError':![]};}}case TOOL_NAMES[_0x3ee2c5(0x1a9)]:{const _0x42c6d9=WarpGrepGitHubArgsSchema[_0x3ee2c5(0x198)](_0x3cada3);if(!_0x42c6d9['success'])return{'content':[{'type':'text','text':_0x3ee2c5(0xa9)+_0x42c6d9[_0x3ee2c5(0x7c)]}],'isError':!![]};const _0x1f7fcf=_0x42c6d9['data'][_0x3ee2c5(0x138)]||_0x42c6d9[_0x3ee2c5(0x17f)][_0x3ee2c5(0xbd)];if(!_0x1f7fcf)return{'content':[{'type':_0x3ee2c5(0xc0),'text':_0x3ee2c5(0x186)}],'isError':!![]};const _0x240ef9=MORPH_API_KEY;if(!_0x240ef9)throw new Error(_0x3ee2c5(0xd0));const _0x3df998=Date[_0x3ee2c5(0x182)]();logger['debug'](_0x3ee2c5(0x14a),_0x3ee2c5(0xec),{'identifier':_0x1f7fcf,'query':_0x42c6d9[_0x3ee2c5(0x17f)][_0x3ee2c5(0x143)],'branch':_0x42c6d9['data']['branch']});try{const _0x2b2580=new WarpGrepClient({'morphApiKey':_0x240ef9,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x92f285=await _0x2b2580[_0x3ee2c5(0x175)]({'searchTerm':_0x42c6d9['data'][_0x3ee2c5(0x143)],'github':_0x1f7fcf,'branch':_0x42c6d9['data'][_0x3ee2c5(0x113)]}),_0x2bdefa=Date[_0x3ee2c5(0x182)]()-_0x3df998;logMcpStderr(_0x3ee2c5(0x15a)+_0x2bdefa+_0x3ee2c5(0x1a2)+_0x92f285[_0x3ee2c5(0x15b)]);const _0x2083fe=formatResult(_0x92f285);return{'content':[{'type':'text','text':_0x2083fe}]};}catch(_0x2b4259){const _0x12a75b=handleMorphAPIError(_0x2b4259);if(_0x12a75b)return _0x12a75b;const _0x15fb66=Date[_0x3ee2c5(0x182)]()-_0x3df998,_0x55a2b5=_0x2b4259 instanceof Error?_0x2b4259[_0x3ee2c5(0xa1)]:String(_0x2b4259);return logMcpStderr(_0x3ee2c5(0x9a)+_0x15fb66+_0x3ee2c5(0xde),_0x55a2b5),reportMorphError({'error_message':_0x55a2b5,'error_type':_0x2b4259 instanceof Error?_0x2b4259['constructor'][_0x3ee2c5(0xae)]:'UnknownError','context':{'tool':_0x3ee2c5(0x177),'github_url':_0x1f7fcf,'search_string':_0x42c6d9[_0x3ee2c5(0x17f)]['search_string'],'branch':_0x42c6d9[_0x3ee2c5(0x17f)][_0x3ee2c5(0x113)]},'stack_trace':_0x2b4259 instanceof Error?_0x2b4259[_0x3ee2c5(0xfb)]:undefined,'source':_0x3ee2c5(0x193),'tool':_0x3ee2c5(0x177),'latency_ms':_0x15fb66})[_0x3ee2c5(0x9d)](()=>{}),{'content':[{'type':_0x3ee2c5(0xc0),'text':'GitHub\x20search\x20failed:\x20'+_0x55a2b5}],'isError':![]};}}default:throw new Error(_0x3ee2c5(0x14c)+_0x2f0d2e);}}catch(_0x50e982){const _0x4918cd=_0x50e982 instanceof Error?_0x50e982[_0x3ee2c5(0xa1)]:String(_0x50e982);return reportMorphError({'error_message':_0x4918cd,'error_type':_0x50e982 instanceof Error?_0x50e982[_0x3ee2c5(0x14d)][_0x3ee2c5(0xae)]:_0x3ee2c5(0xb5),'context':{'tool':_0x2f0d2e,'arguments':_0x3cada3?JSON['stringify'](_0x3cada3)[_0x3ee2c5(0x91)](0x0,0x1f4):undefined,'mcp_server_version':_0x3ee2c5(0xa3)},'stack_trace':_0x50e982 instanceof Error?_0x50e982[_0x3ee2c5(0xfb)]:undefined,'source':_0x3ee2c5(0x193)})[_0x3ee2c5(0x9d)](()=>{}),{'content':[{'type':_0x3ee2c5(0xc0),'text':'Error:\x20'+_0x4918cd}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x33aa1f){const _0x239d9e=a0_0x28086a,_0x2e67fe=await getValidRootDirectories(_0x33aa1f);if(_0x2e67fe[_0x239d9e(0x137)]>0x0)allowedDirectories=[..._0x2e67fe],logMcpStderr(_0x239d9e(0xd6)+_0x2e67fe[_0x239d9e(0x137)]+_0x239d9e(0x16a));else{logMcpStderr(_0x239d9e(0x10c));if(ENABLE_WORKSPACE_MODE)try{const _0x1a4f03=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x1a4f03&&(allowedDirectories=[_0x1a4f03],logMcpStderr(_0x239d9e(0xf3)+_0x1a4f03));}catch(_0x2201db){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x2201db);}}}server[a0_0x28086a(0x86)](RootsListChangedNotificationSchema,async()=>{const _0x5ef497=a0_0x28086a;try{const _0x503b3a=await server['listRoots']();_0x503b3a&&'roots'in _0x503b3a&&await updateAllowedDirectoriesFromRoots(_0x503b3a[_0x5ef497(0xb7)]);}catch(_0x5517b8){logMcpStderr(_0x5ef497(0x7a),_0x5517b8 instanceof Error?_0x5517b8['message']:String(_0x5517b8));}}),server[a0_0x28086a(0xbc)]=async()=>{const _0x2c45af=a0_0x28086a,_0x54e14a=server[_0x2c45af(0x196)]();if(_0x54e14a?.[_0x2c45af(0xb7)])try{const _0x347a9f=await server[_0x2c45af(0xba)]();_0x347a9f&&_0x2c45af(0xb7)in _0x347a9f?await updateAllowedDirectoriesFromRoots(_0x347a9f[_0x2c45af(0xb7)]):logMcpStderr(_0x2c45af(0x7d));}catch(_0x1c352b){logMcpStderr(_0x2c45af(0x11c),_0x1c352b instanceof Error?_0x1c352b['message']:String(_0x1c352b));}else{if(allowedDirectories[_0x2c45af(0x137)]>0x0)logMcpStderr(_0x2c45af(0xd8),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x2c45af(0xd7));else throw new Error(_0x2c45af(0x80));}}};async function runServer(){const _0x2ed625=a0_0x28086a,_0x36938a=new StdioServerTransport();await server[_0x2ed625(0x187)](_0x36938a),logMcpStderr(_0x2ed625(0x19c)),allowedDirectories[_0x2ed625(0x137)]===0x0&&logMcpStderr(_0x2ed625(0xf9));}runServer()['catch'](_0x47bf87=>{const _0x1454b9=a0_0x28086a;logMcpStderr(_0x1454b9(0xc3),_0x47bf87),process[_0x1454b9(0xe7)](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- function a1_0x3c2d(_0x1595e7,_0x8f9932){_0x1595e7=_0x1595e7-0x173;var _0x20a4d5=a1_0x20a4();var _0x3c2db8=_0x20a4d5[_0x1595e7];return _0x3c2db8;}var a1_0xac10da=a1_0x3c2d;function a1_0x20a4(){var _0x1363d8=['8JyrINS','win32','linux','815256TqxYFc','darwin','11YJHkQK','[os=','92346Jmtioq','macOS','MCP','9345732dnVwQn','error','8381210Ibczwl','Windows','535244CMcaFo','5360kMoSid','map','platform','length','3372ehksnI','614404TQiVTd','18GsETjC'];a1_0x20a4=function(){return _0x1363d8;};return a1_0x20a4();}(function(_0x44283f,_0x7020fc){var _0x4de4d3=a1_0x3c2d,_0x498ed7=_0x44283f();while(!![]){try{var _0x13a9a8=-parseInt(_0x4de4d3(0x17e))/0x1*(-parseInt(_0x4de4d3(0x180))/0x2)+parseInt(_0x4de4d3(0x178))/0x3*(-parseInt(_0x4de4d3(0x187))/0x4)+parseInt(_0x4de4d3(0x188))/0x5*(parseInt(_0x4de4d3(0x176))/0x6)+-parseInt(_0x4de4d3(0x177))/0x7*(-parseInt(_0x4de4d3(0x179))/0x8)+parseInt(_0x4de4d3(0x17c))/0x9+-parseInt(_0x4de4d3(0x185))/0xa+parseInt(_0x4de4d3(0x183))/0xb;if(_0x13a9a8===_0x7020fc)break;else _0x498ed7['push'](_0x498ed7['shift']());}catch(_0x14f62c){_0x498ed7['push'](_0x498ed7['shift']());}}}(a1_0x20a4,0x796c4));import a1_0x1af578 from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x49c490=a1_0x1af578[a1_0xac10da(0x174)]()){var _0x554925=a1_0xac10da;switch(_0x49c490){case _0x554925(0x17d):return _0x554925(0x181);case _0x554925(0x17a):return _0x554925(0x186);case _0x554925(0x17b):return'Linux';default:return'Unknown';}}export function formatMcpLogMessage(_0x402f52,_0x5a7dcc=a1_0x1af578[a1_0xac10da(0x174)]()){var _0x259f79=a1_0xac10da;return _0x259f79(0x17f)+getOperatingSystemType(_0x5a7dcc)+']\x20'+_0x402f52;}export function logMcpStderr(_0x1c954c,..._0x4d38c9){var _0x330b22=a1_0xac10da;console[_0x330b22(0x184)](formatMcpLogMessage(_0x1c954c),..._0x4d38c9),logger['info'](_0x330b22(0x182),_0x1c954c,_0x4d38c9[_0x330b22(0x175)]?{'args':_0x4d38c9[_0x330b22(0x173)](_0x46083c=>String(_0x46083c))}:undefined);}
1
+ function a1_0x344b(){var _0x49305d=['2043776cTfxZZ','1630008IAbhAV','[os=','8403550oDreHw','5xQPJtQ','22UJZVXF','67649EpaSZk','error','linux','3650598cAFoup','6108448CwWafp','Unknown','9KCuIOW','596756bawTcR','info','macOS','map','Linux','length','platform','win32'];a1_0x344b=function(){return _0x49305d;};return a1_0x344b();}function a1_0x50c0(_0x4e5166,_0x4ced96){_0x4e5166=_0x4e5166-0x78;var _0x344bc1=a1_0x344b();var _0x50c0fe=_0x344bc1[_0x4e5166];return _0x50c0fe;}var a1_0x1ae033=a1_0x50c0;(function(_0xdafd7f,_0x3ce222){var _0x2e0b1b=a1_0x50c0,_0x5cb8df=_0xdafd7f();while(!![]){try{var _0x5258f6=parseInt(_0x2e0b1b(0x7c))/0x1*(parseInt(_0x2e0b1b(0x7b))/0x2)+parseInt(_0x2e0b1b(0x8c))/0x3+parseInt(_0x2e0b1b(0x83))/0x4*(parseInt(_0x2e0b1b(0x7a))/0x5)+-parseInt(_0x2e0b1b(0x7f))/0x6+-parseInt(_0x2e0b1b(0x8b))/0x7+parseInt(_0x2e0b1b(0x80))/0x8+parseInt(_0x2e0b1b(0x82))/0x9*(-parseInt(_0x2e0b1b(0x79))/0xa);if(_0x5258f6===_0x3ce222)break;else _0x5cb8df['push'](_0x5cb8df['shift']());}catch(_0x3d123b){_0x5cb8df['push'](_0x5cb8df['shift']());}}}(a1_0x344b,0x702c8));import a1_0xe4ff61 from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x2d3f37=a1_0xe4ff61['platform']()){var _0x5b3adb=a1_0x50c0;switch(_0x2d3f37){case'darwin':return _0x5b3adb(0x85);case _0x5b3adb(0x8a):return'Windows';case _0x5b3adb(0x7e):return _0x5b3adb(0x87);default:return _0x5b3adb(0x81);}}export function formatMcpLogMessage(_0x17a29d,_0x520cad=a1_0xe4ff61[a1_0x1ae033(0x89)]()){var _0x1b95c4=a1_0x1ae033;return _0x1b95c4(0x78)+getOperatingSystemType(_0x520cad)+']\x20'+_0x17a29d;}export function logMcpStderr(_0x443705,..._0x3b8348){var _0x294268=a1_0x1ae033;console[_0x294268(0x7d)](formatMcpLogMessage(_0x443705),..._0x3b8348),logger[_0x294268(0x84)]('MCP',_0x443705,_0x3b8348[_0x294268(0x88)]?{'args':_0x3b8348[_0x294268(0x86)](_0xabad05=>String(_0xabad05))}:undefined);}
package/dist/logger.js CHANGED
@@ -1 +1 @@
1
- const a2_0x5e3ae5=a2_0x2936;function a2_0x3419(){const _0x70595d=['105335GSbmaz','141365mPeArL','write','info','debug','enable','46OxEUaP','MORPH_DEBUG','env','32558NyRGHF','warn','517794lvSbGI','296buMSdl','stringify','MORPH_LOG_FILE',']\x20[','10421930fkuSnv','98565mkjTzi','enabled','4471092JdEuyQ','fileStream','error','_log','88NrcxWz'];a2_0x3419=function(){return _0x70595d;};return a2_0x3419();}(function(_0x482975,_0x2700dd){const _0x1c710f=a2_0x2936,_0x259be7=_0x482975();while(!![]){try{const _0x4c810e=parseInt(_0x1c710f(0x74))/0x1+parseInt(_0x1c710f(0x71))/0x2*(parseInt(_0x1c710f(0x7c))/0x3)+-parseInt(_0x1c710f(0x82))/0x4*(parseInt(_0x1c710f(0x83))/0x5)+-parseInt(_0x1c710f(0x76))/0x6+parseInt(_0x1c710f(0x6c))/0x7*(parseInt(_0x1c710f(0x77))/0x8)+parseInt(_0x1c710f(0x7e))/0x9+-parseInt(_0x1c710f(0x7b))/0xa;if(_0x4c810e===_0x2700dd)break;else _0x259be7['push'](_0x259be7['shift']());}catch(_0x9932f0){_0x259be7['push'](_0x259be7['shift']());}}}(a2_0x3419,0x6b7c4));import{createWriteStream}from'fs';class MorphLogger{['enabled'];[a2_0x5e3ae5(0x7f)];constructor(){const _0xeef708=a2_0x5e3ae5;this[_0xeef708(0x7d)]=process[_0xeef708(0x73)][_0xeef708(0x72)]==='1'||!!process[_0xeef708(0x73)][_0xeef708(0x79)];const _0x4eb586=process['env']['MORPH_LOG_FILE'];this[_0xeef708(0x7f)]=_0x4eb586?createWriteStream(_0x4eb586,{'flags':'a'}):null;}[a2_0x5e3ae5(0x6f)](_0x50a9d4,_0x2fcbd4,_0x1610ef){const _0x26e9ce=a2_0x5e3ae5;this[_0x26e9ce(0x81)](_0x26e9ce(0x6f),_0x50a9d4,_0x2fcbd4,_0x1610ef);}[a2_0x5e3ae5(0x6e)](_0x5a041f,_0x44bf17,_0x427d34){const _0x70496f=a2_0x5e3ae5;this[_0x70496f(0x81)](_0x70496f(0x6e),_0x5a041f,_0x44bf17,_0x427d34);}[a2_0x5e3ae5(0x75)](_0x46cc1d,_0x587613,_0x3f2149){const _0x58699a=a2_0x5e3ae5;this[_0x58699a(0x81)]('warn',_0x46cc1d,_0x587613,_0x3f2149);}[a2_0x5e3ae5(0x80)](_0x45ada2,_0x3d6045,_0x2107d9){const _0x2af769=a2_0x5e3ae5;this[_0x2af769(0x81)](_0x2af769(0x80),_0x45ada2,_0x3d6045,_0x2107d9);}[a2_0x5e3ae5(0x70)](){const _0x5eed86=a2_0x5e3ae5;this[_0x5eed86(0x7d)]=!![];}get['isEnabled'](){const _0x1a1964=a2_0x5e3ae5;return this[_0x1a1964(0x7d)];}['_log'](_0x27eca0,_0x4f4b66,_0xe10e72,_0x27458e){const _0xa7943f=a2_0x5e3ae5;if(_0x27eca0!==_0xa7943f(0x80)&&!this[_0xa7943f(0x7d)])return;const _0x39e759=new Date()['toISOString'](),_0x8647d1='['+_0x39e759+_0xa7943f(0x7a)+_0x27eca0['toUpperCase']()+_0xa7943f(0x7a)+_0x4f4b66+']';console[_0xa7943f(0x80)](_0x27458e?_0x8647d1+'\x20'+_0xe10e72+'\x20'+JSON[_0xa7943f(0x78)](_0x27458e):_0x8647d1+'\x20'+_0xe10e72),this[_0xa7943f(0x7f)]?.[_0xa7943f(0x6d)](JSON[_0xa7943f(0x78)]({'ts':_0x39e759,'level':_0x27eca0,'component':_0x4f4b66,'msg':_0xe10e72,..._0x27458e&&{'data':_0x27458e}})+'\x0a');}}function a2_0x2936(_0x1220da,_0x20da0b){_0x1220da=_0x1220da-0x6c;const _0x34196b=a2_0x3419();let _0x293639=_0x34196b[_0x1220da];return _0x293639;}export const logger=new MorphLogger();
1
+ const a2_0x579cf6=a2_0x27e0;function a2_0x27e0(_0x3c5479,_0x4873f2){_0x3c5479=_0x3c5479-0x1bd;const _0x421736=a2_0x4217();let _0x27e09d=_0x421736[_0x3c5479];return _0x27e09d;}(function(_0x13198b,_0xa47f87){const _0x4c4dff=a2_0x27e0,_0x36148e=_0x13198b();while(!![]){try{const _0x369203=-parseInt(_0x4c4dff(0x1cc))/0x1*(-parseInt(_0x4c4dff(0x1c5))/0x2)+-parseInt(_0x4c4dff(0x1ce))/0x3+-parseInt(_0x4c4dff(0x1bf))/0x4+parseInt(_0x4c4dff(0x1cb))/0x5*(-parseInt(_0x4c4dff(0x1ca))/0x6)+parseInt(_0x4c4dff(0x1bd))/0x7*(-parseInt(_0x4c4dff(0x1d0))/0x8)+parseInt(_0x4c4dff(0x1d6))/0x9+-parseInt(_0x4c4dff(0x1d3))/0xa*(-parseInt(_0x4c4dff(0x1d1))/0xb);if(_0x369203===_0xa47f87)break;else _0x36148e['push'](_0x36148e['shift']());}catch(_0x8e302b){_0x36148e['push'](_0x36148e['shift']());}}}(a2_0x4217,0x7e3c3));function a2_0x4217(){const _0xe0fe75=['7xgwskN','info','3396132VlxcPW','debug','isEnabled','fileStream','toISOString','stringify','85978szCJKk','_log','enabled','write','MORPH_DEBUG','6kkKrxc','1804470PHIlXR','2cXqLJE','enable','2571411axurpR','warn','1176248BlrgHu','110yRzOeE','error','1845530xlefDw','env','toUpperCase','7196814ksCrjK'];a2_0x4217=function(){return _0xe0fe75;};return a2_0x4217();}import{createWriteStream}from'fs';class MorphLogger{['enabled'];['fileStream'];constructor(){const _0x1d6834=a2_0x27e0;this['enabled']=process['env'][_0x1d6834(0x1c9)]==='1'||!!process[_0x1d6834(0x1d4)]['MORPH_LOG_FILE'];const _0x118a42=process[_0x1d6834(0x1d4)]['MORPH_LOG_FILE'];this[_0x1d6834(0x1c2)]=_0x118a42?createWriteStream(_0x118a42,{'flags':'a'}):null;}[a2_0x579cf6(0x1c0)](_0x15b846,_0x2590e9,_0x5dcd8b){const _0x130d1d=a2_0x579cf6;this[_0x130d1d(0x1c6)](_0x130d1d(0x1c0),_0x15b846,_0x2590e9,_0x5dcd8b);}[a2_0x579cf6(0x1be)](_0x53f7e5,_0x422b2b,_0x4ae132){const _0x5aa274=a2_0x579cf6;this[_0x5aa274(0x1c6)](_0x5aa274(0x1be),_0x53f7e5,_0x422b2b,_0x4ae132);}[a2_0x579cf6(0x1cf)](_0x267cc6,_0x2af3cc,_0x1d54fb){const _0x482c93=a2_0x579cf6;this[_0x482c93(0x1c6)]('warn',_0x267cc6,_0x2af3cc,_0x1d54fb);}[a2_0x579cf6(0x1d2)](_0x4c9ad8,_0x86c6b,_0x5ccc60){const _0x883a17=a2_0x579cf6;this[_0x883a17(0x1c6)]('error',_0x4c9ad8,_0x86c6b,_0x5ccc60);}[a2_0x579cf6(0x1cd)](){this['enabled']=!![];}get[a2_0x579cf6(0x1c1)](){const _0x6440d6=a2_0x579cf6;return this[_0x6440d6(0x1c7)];}[a2_0x579cf6(0x1c6)](_0x53a44d,_0x37b9f1,_0x2611fe,_0x30d371){const _0x382192=a2_0x579cf6;if(_0x53a44d!==_0x382192(0x1d2)&&!this[_0x382192(0x1c7)])return;const _0x171228=new Date()[_0x382192(0x1c3)](),_0x4388bc='['+_0x171228+']\x20['+_0x53a44d[_0x382192(0x1d5)]()+']\x20['+_0x37b9f1+']';console['error'](_0x30d371?_0x4388bc+'\x20'+_0x2611fe+'\x20'+JSON[_0x382192(0x1c4)](_0x30d371):_0x4388bc+'\x20'+_0x2611fe),this['fileStream']?.[_0x382192(0x1c8)](JSON['stringify']({'ts':_0x171228,'level':_0x53a44d,'component':_0x37b9f1,'msg':_0x2611fe,..._0x30d371&&{'data':_0x30d371}})+'\x0a');}}export const logger=new MorphLogger();
@@ -1 +1 @@
1
- function a3_0x1a13(){const _0x21f4c4=['30736AgrXqV','toUpperCase','2283410BlOnme','212uoVWcz','1890423NHJwLx','trim','278897lhnHHP','substring','join','test','slice','normalize','150416IZKEub','54ogwVeM','match','charAt','18970jhmcfT','/mnt/','372534qtuqCk','replace','11IeGGwX','startsWith','2xqZbJg'];a3_0x1a13=function(){return _0x21f4c4;};return a3_0x1a13();}function a3_0x919d(_0x29b6aa,_0xc12872){_0x29b6aa=_0x29b6aa-0xe1;const _0x1a13bc=a3_0x1a13();let _0x919d15=_0x1a13bc[_0x29b6aa];return _0x919d15;}(function(_0x502088,_0x3804a2){const _0x3b8287=a3_0x919d,_0x3840c6=_0x502088();while(!![]){try{const _0x1d493b=parseInt(_0x3b8287(0xe1))/0x1+parseInt(_0x3b8287(0xf1))/0x2*(-parseInt(_0x3b8287(0xed))/0x3)+parseInt(_0x3b8287(0xf5))/0x4*(parseInt(_0x3b8287(0xeb))/0x5)+-parseInt(_0x3b8287(0xe8))/0x6*(parseInt(_0x3b8287(0xe7))/0x7)+-parseInt(_0x3b8287(0xf2))/0x8+parseInt(_0x3b8287(0xf6))/0x9+parseInt(_0x3b8287(0xf4))/0xa*(-parseInt(_0x3b8287(0xef))/0xb);if(_0x1d493b===_0x3804a2)break;else _0x3840c6['push'](_0x3840c6['shift']());}catch(_0x287f9e){_0x3840c6['push'](_0x3840c6['shift']());}}}(a3_0x1a13,0x223f1));import a3_0x25cb80 from'path';import a3_0x4d5b8a from'os';export function convertToWindowsPath(_0x379240){const _0x5b5a9a=a3_0x919d;if(_0x379240[_0x5b5a9a(0xf0)](_0x5b5a9a(0xec))){const _0x9700f7=_0x379240[_0x5b5a9a(0xea)](0x5)['toUpperCase'](),_0x3c5562=_0x379240[_0x5b5a9a(0xe5)](0x6)[_0x5b5a9a(0xee)](/\//g,'\x5c');return _0x9700f7+':'+_0x3c5562;}if(_0x379240[_0x5b5a9a(0xe9)](/^\/[a-zA-Z]\//)){const _0x3e1652=_0x379240[_0x5b5a9a(0xea)](0x1)[_0x5b5a9a(0xf3)](),_0x20fc80=_0x379240[_0x5b5a9a(0xe5)](0x2)[_0x5b5a9a(0xee)](/\//g,'\x5c');return _0x3e1652+':'+_0x20fc80;}if(_0x379240[_0x5b5a9a(0xe9)](/^[a-zA-Z]:/))return _0x379240['replace'](/\//g,'\x5c');return _0x379240;}export function normalizePath(_0xffd433){const _0x38b0b4=a3_0x919d;_0xffd433=_0xffd433[_0x38b0b4(0xf7)]()[_0x38b0b4(0xee)](/^["']|["']$/g,'');const _0x3f20e9=_0xffd433[_0x38b0b4(0xf0)]('/')&&!_0xffd433[_0x38b0b4(0xe9)](/^\/mnt\/[a-z]\//i)&&!_0xffd433[_0x38b0b4(0xe9)](/^\/[a-zA-Z]\//);if(_0x3f20e9)return _0xffd433[_0x38b0b4(0xee)](/\/+/g,'/')[_0x38b0b4(0xee)](/\/+$/,'');_0xffd433=convertToWindowsPath(_0xffd433);if(_0xffd433[_0x38b0b4(0xf0)]('\x5c\x5c')){let _0x4c7787=_0xffd433;_0x4c7787=_0x4c7787[_0x38b0b4(0xee)](/^\\{2,}/,'\x5c\x5c');const _0xbca6a7=_0x4c7787[_0x38b0b4(0xe2)](0x2)['replace'](/\\\\/g,'\x5c');_0xffd433='\x5c\x5c'+_0xbca6a7;}else _0xffd433=_0xffd433['replace'](/\\\\/g,'\x5c');let _0x45f85a=a3_0x25cb80[_0x38b0b4(0xe6)](_0xffd433);_0xffd433[_0x38b0b4(0xf0)]('\x5c\x5c')&&!_0x45f85a[_0x38b0b4(0xf0)]('\x5c\x5c')&&(_0x45f85a='\x5c'+_0x45f85a);if(_0x45f85a[_0x38b0b4(0xe9)](/^[a-zA-Z]:/)){let _0x121985=_0x45f85a[_0x38b0b4(0xee)](/\//g,'\x5c');return/^[a-z]:/[_0x38b0b4(0xe4)](_0x121985)&&(_0x121985=_0x121985[_0x38b0b4(0xea)](0x0)[_0x38b0b4(0xf3)]()+_0x121985['slice'](0x1)),_0x121985;}return _0x45f85a['replace'](/\//g,'\x5c');}export function expandHome(_0x29e9d7){const _0x1eef9a=a3_0x919d;if(_0x29e9d7[_0x1eef9a(0xf0)]('~/')||_0x29e9d7==='~')return a3_0x25cb80[_0x1eef9a(0xe3)](a3_0x4d5b8a['homedir'](),_0x29e9d7[_0x1eef9a(0xe5)](0x1));return _0x29e9d7;}
1
+ function a3_0x4461(_0xf324fe,_0x174ff8){_0xf324fe=_0xf324fe-0x16c;const _0x244f74=a3_0x244f();let _0x44610f=_0x244f74[_0xf324fe];return _0x44610f;}(function(_0x413942,_0x133958){const _0xfac1f2=a3_0x4461,_0x1b1871=_0x413942();while(!![]){try{const _0x389994=-parseInt(_0xfac1f2(0x171))/0x1*(-parseInt(_0xfac1f2(0x17e))/0x2)+parseInt(_0xfac1f2(0x16e))/0x3*(-parseInt(_0xfac1f2(0x181))/0x4)+-parseInt(_0xfac1f2(0x170))/0x5+-parseInt(_0xfac1f2(0x174))/0x6*(-parseInt(_0xfac1f2(0x180))/0x7)+parseInt(_0xfac1f2(0x178))/0x8+parseInt(_0xfac1f2(0x172))/0x9+-parseInt(_0xfac1f2(0x175))/0xa*(parseInt(_0xfac1f2(0x173))/0xb);if(_0x389994===_0x133958)break;else _0x1b1871['push'](_0x1b1871['shift']());}catch(_0x4be656){_0x1b1871['push'](_0x1b1871['shift']());}}}(a3_0x244f,0xb48e7));import a3_0x40b901 from'path';import a3_0x45e4f8 from'os';function a3_0x244f(){const _0x33301d=['4670880MpAckY','slice','startsWith','match','/mnt/','replace','2GvNfDz','homedir','357rpFVij','14764aVXBCa','charAt','substring','toUpperCase','483quMjgs','trim','3288985zwADSx','1084565wbIJEl','9735714WHgKCF','11rgmRUH','47418KcUMxI','11616170huqYNU','test','normalize'];a3_0x244f=function(){return _0x33301d;};return a3_0x244f();}export function convertToWindowsPath(_0xd63516){const _0x822a42=a3_0x4461;if(_0xd63516[_0x822a42(0x17a)](_0x822a42(0x17c))){const _0x3984e8=_0xd63516[_0x822a42(0x182)](0x5)[_0x822a42(0x16d)](),_0x2aa9bb=_0xd63516['slice'](0x6)[_0x822a42(0x17d)](/\//g,'\x5c');return _0x3984e8+':'+_0x2aa9bb;}if(_0xd63516[_0x822a42(0x17b)](/^\/[a-zA-Z]\//)){const _0x1aad2e=_0xd63516[_0x822a42(0x182)](0x1)['toUpperCase'](),_0x2be08f=_0xd63516[_0x822a42(0x179)](0x2)[_0x822a42(0x17d)](/\//g,'\x5c');return _0x1aad2e+':'+_0x2be08f;}if(_0xd63516[_0x822a42(0x17b)](/^[a-zA-Z]:/))return _0xd63516['replace'](/\//g,'\x5c');return _0xd63516;}export function normalizePath(_0x4c99d9){const _0x189b2b=a3_0x4461;_0x4c99d9=_0x4c99d9[_0x189b2b(0x16f)]()[_0x189b2b(0x17d)](/^["']|["']$/g,'');const _0x13e144=_0x4c99d9[_0x189b2b(0x17a)]('/')&&!_0x4c99d9['match'](/^\/mnt\/[a-z]\//i)&&!_0x4c99d9[_0x189b2b(0x17b)](/^\/[a-zA-Z]\//);if(_0x13e144)return _0x4c99d9[_0x189b2b(0x17d)](/\/+/g,'/')[_0x189b2b(0x17d)](/\/+$/,'');_0x4c99d9=convertToWindowsPath(_0x4c99d9);if(_0x4c99d9[_0x189b2b(0x17a)]('\x5c\x5c')){let _0x1fc11b=_0x4c99d9;_0x1fc11b=_0x1fc11b['replace'](/^\\{2,}/,'\x5c\x5c');const _0x8bce7c=_0x1fc11b[_0x189b2b(0x16c)](0x2)[_0x189b2b(0x17d)](/\\\\/g,'\x5c');_0x4c99d9='\x5c\x5c'+_0x8bce7c;}else _0x4c99d9=_0x4c99d9['replace'](/\\\\/g,'\x5c');let _0x120804=a3_0x40b901[_0x189b2b(0x177)](_0x4c99d9);_0x4c99d9[_0x189b2b(0x17a)]('\x5c\x5c')&&!_0x120804[_0x189b2b(0x17a)]('\x5c\x5c')&&(_0x120804='\x5c'+_0x120804);if(_0x120804[_0x189b2b(0x17b)](/^[a-zA-Z]:/)){let _0x3730c3=_0x120804[_0x189b2b(0x17d)](/\//g,'\x5c');return/^[a-z]:/[_0x189b2b(0x176)](_0x3730c3)&&(_0x3730c3=_0x3730c3[_0x189b2b(0x182)](0x0)[_0x189b2b(0x16d)]()+_0x3730c3[_0x189b2b(0x179)](0x1)),_0x3730c3;}return _0x120804[_0x189b2b(0x17d)](/\//g,'\x5c');}export function expandHome(_0x351fba){const _0x5387bb=a3_0x4461;if(_0x351fba['startsWith']('~/')||_0x351fba==='~')return a3_0x40b901['join'](a3_0x45e4f8[_0x5387bb(0x17f)](),_0x351fba['slice'](0x1));return _0x351fba;}
@@ -1 +1 @@
1
- function a4_0x5cdd(){const _0x27a67a=['string','includes','5780355SgBqpG','8668122UBpBeO','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','2233665mISDoo','9323636oEvqhG','sep','some','517236WCbnUc','621112VsCXzD','64tLxtzj','isAbsolute','Path\x20must\x20be\x20absolute\x20after\x20normalization','2545272wOyrLr','resolve','startsWith','4LAwUSs','normalize'];a4_0x5cdd=function(){return _0x27a67a;};return a4_0x5cdd();}(function(_0x5365e2,_0x435ec1){const _0xf4f691=a4_0x932f,_0x2dba4b=_0x5365e2();while(!![]){try{const _0x720e30=-parseInt(_0xf4f691(0x1ae))/0x1*(parseInt(_0xf4f691(0x1b9))/0x2)+parseInt(_0xf4f691(0x1b5))/0x3+parseInt(_0xf4f691(0x1ba))/0x4+-parseInt(_0xf4f691(0x1b2))/0x5+-parseInt(_0xf4f691(0x1b3))/0x6+parseInt(_0xf4f691(0x1b6))/0x7+-parseInt(_0xf4f691(0x1bb))/0x8*(-parseInt(_0xf4f691(0x1ab))/0x9);if(_0x720e30===_0x435ec1)break;else _0x2dba4b['push'](_0x2dba4b['shift']());}catch(_0x362413){_0x2dba4b['push'](_0x2dba4b['shift']());}}}(a4_0x5cdd,0xd1b87));import a4_0x41fe5a from'path';function a4_0x932f(_0x353596,_0x2caa52){_0x353596=_0x353596-0x1a9;const _0x5cdd03=a4_0x5cdd();let _0x932f92=_0x5cdd03[_0x353596];return _0x932f92;}export function isPathWithinAllowedDirectories(_0x1e001a,_0x361f91){const _0x40464c=a4_0x932f;if(typeof _0x1e001a!==_0x40464c(0x1b0)||!Array['isArray'](_0x361f91))return![];if(!_0x1e001a||_0x361f91['length']===0x0)return![];if(_0x1e001a['includes']('\x00'))return![];let _0x4acd4f;try{_0x4acd4f=a4_0x41fe5a[_0x40464c(0x1ac)](a4_0x41fe5a[_0x40464c(0x1af)](_0x1e001a));}catch{return![];}if(!a4_0x41fe5a[_0x40464c(0x1a9)](_0x4acd4f))throw new Error(_0x40464c(0x1aa));return _0x361f91[_0x40464c(0x1b8)](_0x1e348e=>{const _0x380681=_0x40464c;if(typeof _0x1e348e!==_0x380681(0x1b0)||!_0x1e348e)return![];if(_0x1e348e[_0x380681(0x1b1)]('\x00'))return![];let _0x2e564f;try{_0x2e564f=a4_0x41fe5a[_0x380681(0x1ac)](a4_0x41fe5a[_0x380681(0x1af)](_0x1e348e));}catch{return![];}if(!a4_0x41fe5a[_0x380681(0x1a9)](_0x2e564f))throw new Error(_0x380681(0x1b4));if(_0x4acd4f===_0x2e564f)return!![];if(_0x2e564f===a4_0x41fe5a[_0x380681(0x1b7)])return _0x4acd4f[_0x380681(0x1ad)](a4_0x41fe5a[_0x380681(0x1b7)]);return _0x4acd4f[_0x380681(0x1ad)](_0x2e564f+a4_0x41fe5a[_0x380681(0x1b7)]);});}
1
+ (function(_0x5c56b4,_0x2c59f7){const _0x1b7a0f=a4_0x13ef,_0x4477c5=_0x5c56b4();while(!![]){try{const _0x128836=parseInt(_0x1b7a0f(0x1e6))/0x1*(parseInt(_0x1b7a0f(0x1e8))/0x2)+parseInt(_0x1b7a0f(0x1ef))/0x3+parseInt(_0x1b7a0f(0x1de))/0x4+-parseInt(_0x1b7a0f(0x1ec))/0x5+parseInt(_0x1b7a0f(0x1ea))/0x6*(parseInt(_0x1b7a0f(0x1e5))/0x7)+parseInt(_0x1b7a0f(0x1eb))/0x8*(parseInt(_0x1b7a0f(0x1dc))/0x9)+-parseInt(_0x1b7a0f(0x1ee))/0xa;if(_0x128836===_0x2c59f7)break;else _0x4477c5['push'](_0x4477c5['shift']());}catch(_0x15a5a0){_0x4477c5['push'](_0x4477c5['shift']());}}}(a4_0x4efe,0x731db));function a4_0x13ef(_0x48e88a,_0x30c91c){_0x48e88a=_0x48e88a-0x1dc;const _0x4efea1=a4_0x4efe();let _0x13ef46=_0x4efea1[_0x48e88a];return _0x13ef46;}import a4_0x21380b from'path';export function isPathWithinAllowedDirectories(_0x6dbe9c,_0x40dbc2){const _0x1392f9=a4_0x13ef;if(typeof _0x6dbe9c!==_0x1392f9(0x1ed)||!Array[_0x1392f9(0x1e0)](_0x40dbc2))return![];if(!_0x6dbe9c||_0x40dbc2['length']===0x0)return![];if(_0x6dbe9c[_0x1392f9(0x1df)]('\x00'))return![];let _0x74c866;try{_0x74c866=a4_0x21380b['resolve'](a4_0x21380b[_0x1392f9(0x1e1)](_0x6dbe9c));}catch{return![];}if(!a4_0x21380b[_0x1392f9(0x1e4)](_0x74c866))throw new Error(_0x1392f9(0x1dd));return _0x40dbc2[_0x1392f9(0x1e2)](_0x416507=>{const _0x3abac3=_0x1392f9;if(typeof _0x416507!==_0x3abac3(0x1ed)||!_0x416507)return![];if(_0x416507[_0x3abac3(0x1df)]('\x00'))return![];let _0x4f6f12;try{_0x4f6f12=a4_0x21380b[_0x3abac3(0x1e3)](a4_0x21380b[_0x3abac3(0x1e1)](_0x416507));}catch{return![];}if(!a4_0x21380b[_0x3abac3(0x1e4)](_0x4f6f12))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x74c866===_0x4f6f12)return!![];if(_0x4f6f12===a4_0x21380b[_0x3abac3(0x1e7)])return _0x74c866[_0x3abac3(0x1e9)](a4_0x21380b[_0x3abac3(0x1e7)]);return _0x74c866[_0x3abac3(0x1e9)](_0x4f6f12+a4_0x21380b[_0x3abac3(0x1e7)]);});}function a4_0x4efe(){const _0x587d95=['3784205EJTpBV','string','21553720ANwCZV','1822356OTvhNt','9xVopgB','Path\x20must\x20be\x20absolute\x20after\x20normalization','1463952KYIqBp','includes','isArray','normalize','some','resolve','isAbsolute','18683yWlUYA','2OLWctu','sep','938658XxaEhw','startsWith','1962SUQhHD','4790936dzPSwq'];a4_0x4efe=function(){return _0x587d95;};return a4_0x4efe();}
@@ -1 +1 @@
1
- (function(_0x355003,_0x327df5){const _0x1633d5=a5_0x5a78,_0x3542ee=_0x355003();while(!![]){try{const _0x10cb88=-parseInt(_0x1633d5(0x1d4))/0x1*(-parseInt(_0x1633d5(0x1e1))/0x2)+-parseInt(_0x1633d5(0x1cd))/0x3+-parseInt(_0x1633d5(0x1d7))/0x4+-parseInt(_0x1633d5(0x1da))/0x5*(parseInt(_0x1633d5(0x1e0))/0x6)+-parseInt(_0x1633d5(0x1ce))/0x7*(parseInt(_0x1633d5(0x1ca))/0x8)+parseInt(_0x1633d5(0x1d6))/0x9*(-parseInt(_0x1633d5(0x1d2))/0xa)+parseInt(_0x1633d5(0x1cb))/0xb*(parseInt(_0x1633d5(0x1d5))/0xc);if(_0x10cb88===_0x327df5)break;else _0x3542ee['push'](_0x3542ee['shift']());}catch(_0x4a062f){_0x3542ee['push'](_0x3542ee['shift']());}}}(a5_0x58b0,0x78b01));import{promises as a5_0x27f429}from'fs';import a5_0x3e745a from'path';import a5_0x5425a2 from'os';function a5_0x58b0(){const _0x5ae6de=['2215244ulytKl','stat','join','122015BIPYnt','push','uri','startsWith','non-directory\x20root','slice','12mvwSqy','169718ZmEcde','8sCyNqT','11dQNonh','\x20due\x20to\x20error:\x20','1416861PXwmnM','146692QTgfBD','Skipping\x20invalid\x20directory:\x20','Skipping\x20','homedir','5621030XTAxUr','message','5lapzAb','20736060MiQqOr','9izYvuE'];a5_0x58b0=function(){return _0x5ae6de;};return a5_0x58b0();}import{normalizePath}from'./path-utils.js';function a5_0x5a78(_0x51cd38,_0x4a4d17){_0x51cd38=_0x51cd38-0x1ca;const _0x58b06c=a5_0x58b0();let _0x5a78a4=_0x58b06c[_0x51cd38];return _0x5a78a4;}import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x2b7e2a){const _0x134d68=a5_0x5a78;try{const _0x121477=_0x2b7e2a[_0x134d68(0x1dd)]('file://')?_0x2b7e2a[_0x134d68(0x1df)](0x7):_0x2b7e2a,_0x580283=_0x121477[_0x134d68(0x1dd)]('~/')||_0x121477==='~'?a5_0x3e745a[_0x134d68(0x1d9)](a5_0x5425a2[_0x134d68(0x1d1)](),_0x121477[_0x134d68(0x1df)](0x1)):_0x121477,_0x27dbbe=a5_0x3e745a['resolve'](_0x580283),_0x8cb7c5=await a5_0x27f429['realpath'](_0x27dbbe);return normalizePath(_0x8cb7c5);}catch{return null;}}function formatDirectoryError(_0x567438,_0x39e2de,_0x3b99a7){const _0x520eb6=a5_0x5a78;if(_0x3b99a7)return _0x520eb6(0x1d0)+_0x3b99a7+':\x20'+_0x567438;const _0x44c98e=_0x39e2de instanceof Error?_0x39e2de[_0x520eb6(0x1d3)]:String(_0x39e2de);return _0x520eb6(0x1cf)+_0x567438+_0x520eb6(0x1cc)+_0x44c98e;}export async function getValidRootDirectories(_0x56a71b){const _0x4a623a=a5_0x5a78,_0x10ed90=[];for(const _0x1feced of _0x56a71b){const _0x44e676=await parseRootUri(_0x1feced[_0x4a623a(0x1dc)]);if(!_0x44e676){logMcpStderr(formatDirectoryError(_0x1feced[_0x4a623a(0x1dc)],undefined,'invalid\x20path\x20or\x20inaccessible'));continue;}try{const _0x4e7a31=await a5_0x27f429[_0x4a623a(0x1d8)](_0x44e676);_0x4e7a31['isDirectory']()?_0x10ed90[_0x4a623a(0x1db)](_0x44e676):logMcpStderr(formatDirectoryError(_0x44e676,undefined,_0x4a623a(0x1de)));}catch(_0x383ef2){logMcpStderr(formatDirectoryError(_0x44e676,_0x383ef2));}}return _0x10ed90;}
1
+ (function(_0x2901f6,_0x5842a7){const _0x1db1c4=a5_0x306b,_0x4176dd=_0x2901f6();while(!![]){try{const _0x4714eb=-parseInt(_0x1db1c4(0xb8))/0x1*(parseInt(_0x1db1c4(0xc5))/0x2)+parseInt(_0x1db1c4(0xc0))/0x3+-parseInt(_0x1db1c4(0xb1))/0x4+parseInt(_0x1db1c4(0xbe))/0x5*(parseInt(_0x1db1c4(0xb4))/0x6)+parseInt(_0x1db1c4(0xc4))/0x7*(parseInt(_0x1db1c4(0xbb))/0x8)+parseInt(_0x1db1c4(0xbc))/0x9*(-parseInt(_0x1db1c4(0xb7))/0xa)+-parseInt(_0x1db1c4(0xb3))/0xb;if(_0x4714eb===_0x5842a7)break;else _0x4176dd['push'](_0x4176dd['shift']());}catch(_0x67d8a7){_0x4176dd['push'](_0x4176dd['shift']());}}}(a5_0xc50a,0x21513));import{promises as a5_0x8669cf}from'fs';function a5_0xc50a(){const _0x20cd11=['startsWith','480627OheKQp','stat','\x20due\x20to\x20error:\x20','invalid\x20path\x20or\x20inaccessible','35WtdWiy','44HXcIIY','non-directory\x20root','join','push','182752dcRvoq','file://','547426qHDsWX','3426JwVwCy','Skipping\x20invalid\x20directory:\x20','message','620tOhUqP','1645IIxmNp','isDirectory','resolve','233848wNJQJb','9117FvhBhv','slice','215btkqSb'];a5_0xc50a=function(){return _0x20cd11;};return a5_0xc50a();}function a5_0x306b(_0x161c6d,_0x32e82b){_0x161c6d=_0x161c6d-0xae;const _0xc50ad7=a5_0xc50a();let _0x306b9b=_0xc50ad7[_0x161c6d];return _0x306b9b;}import a5_0x5a6f8d from'path';import a5_0x54057d from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x15cf71){const _0x5ef2a6=a5_0x306b;try{const _0x2422d6=_0x15cf71['startsWith'](_0x5ef2a6(0xb2))?_0x15cf71[_0x5ef2a6(0xbd)](0x7):_0x15cf71,_0x3e441f=_0x2422d6[_0x5ef2a6(0xbf)]('~/')||_0x2422d6==='~'?a5_0x5a6f8d[_0x5ef2a6(0xaf)](a5_0x54057d['homedir'](),_0x2422d6[_0x5ef2a6(0xbd)](0x1)):_0x2422d6,_0x260b14=a5_0x5a6f8d[_0x5ef2a6(0xba)](_0x3e441f),_0x305683=await a5_0x8669cf['realpath'](_0x260b14);return normalizePath(_0x305683);}catch{return null;}}function formatDirectoryError(_0x5e3cd9,_0x425ba9,_0x52365d){const _0x3d4357=a5_0x306b;if(_0x52365d)return'Skipping\x20'+_0x52365d+':\x20'+_0x5e3cd9;const _0x25f107=_0x425ba9 instanceof Error?_0x425ba9[_0x3d4357(0xb6)]:String(_0x425ba9);return _0x3d4357(0xb5)+_0x5e3cd9+_0x3d4357(0xc2)+_0x25f107;}export async function getValidRootDirectories(_0x3d4e47){const _0x580ec9=a5_0x306b,_0xcfdc97=[];for(const _0x1204a2 of _0x3d4e47){const _0x32dfb7=await parseRootUri(_0x1204a2['uri']);if(!_0x32dfb7){logMcpStderr(formatDirectoryError(_0x1204a2['uri'],undefined,_0x580ec9(0xc3)));continue;}try{const _0x3cd657=await a5_0x8669cf[_0x580ec9(0xc1)](_0x32dfb7);_0x3cd657[_0x580ec9(0xb9)]()?_0xcfdc97[_0x580ec9(0xb0)](_0x32dfb7):logMcpStderr(formatDirectoryError(_0x32dfb7,undefined,_0x580ec9(0xae)));}catch(_0x208b4d){logMcpStderr(formatDirectoryError(_0x32dfb7,_0x208b4d));}}return _0xcfdc97;}
@@ -1 +1 @@
1
- function a6_0x24c9(){const _0x362bec=['codebase_search','values','4362795sCHpBT','109932tIiBCy','2324224gSaGxD','github_codebase_search','80BnrUjq','2058954ktsJaf','72oxPJqw','17eEPUJR','27981rTUMtS','752uwZwoY','27838IphTIX','3956612kSQmCU'];a6_0x24c9=function(){return _0x362bec;};return a6_0x24c9();}const a6_0x2ff8c7=a6_0x1a82;(function(_0x114a52,_0x3eb95b){const _0x141e8d=a6_0x1a82,_0x4d23b6=_0x114a52();while(!![]){try{const _0x1a7759=-parseInt(_0x141e8d(0xd1))/0x1*(parseInt(_0x141e8d(0xd4))/0x2)+-parseInt(_0x141e8d(0xd0))/0x3*(parseInt(_0x141e8d(0xd9))/0x4)+-parseInt(_0x141e8d(0xd8))/0x5+parseInt(_0x141e8d(0xcf))/0x6+-parseInt(_0x141e8d(0xda))/0x7+-parseInt(_0x141e8d(0xd3))/0x8*(parseInt(_0x141e8d(0xd2))/0x9)+parseInt(_0x141e8d(0xce))/0xa*(parseInt(_0x141e8d(0xd5))/0xb);if(_0x1a7759===_0x3eb95b)break;else _0x4d23b6['push'](_0x4d23b6['shift']());}catch(_0xc73ea7){_0x4d23b6['push'](_0x4d23b6['shift']());}}}(a6_0x24c9,0xca0fb));function a6_0x1a82(_0x224abd,_0x3f6283){_0x224abd=_0x224abd-0xcd;const _0x24c9c4=a6_0x24c9();let _0x1a82e4=_0x24c9c4[_0x224abd];return _0x1a82e4;}export const TOOL_NAMES={'EDIT_FILE':'edit_file','CODEBASE_SEARCH':a6_0x2ff8c7(0xd6),'GITHUB_CODEBASE_SEARCH':a6_0x2ff8c7(0xcd)};export const ALL_TOOL_NAMES=Object[a6_0x2ff8c7(0xd7)](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
1
+ function a6_0x4ef8(_0x571992,_0x83da16){_0x571992=_0x571992-0xb3;const _0x452ba5=a6_0x452b();let _0x4ef850=_0x452ba5[_0x571992];return _0x4ef850;}function a6_0x452b(){const _0x3052e5=['207hIsGjj','75144gxXTHB','3849352PdjkVU','7701642IqlnCB','7969682tHxvdl','3683466QyWsWZ','6030485ttRZKC','12WFJlyH','codebase_search','edit_file','159266RHtmDn','values'];a6_0x452b=function(){return _0x3052e5;};return a6_0x452b();}const a6_0x452d7=a6_0x4ef8;(function(_0x19dc0f,_0x2c24da){const _0x2b58f2=a6_0x4ef8,_0x522081=_0x19dc0f();while(!![]){try{const _0x104635=parseInt(_0x2b58f2(0xb5))/0x1*(-parseInt(_0x2b58f2(0xbe))/0x2)+parseInt(_0x2b58f2(0xbc))/0x3+-parseInt(_0x2b58f2(0xb9))/0x4+-parseInt(_0x2b58f2(0xbd))/0x5+parseInt(_0x2b58f2(0xba))/0x6+parseInt(_0x2b58f2(0xbb))/0x7+-parseInt(_0x2b58f2(0xb8))/0x8*(-parseInt(_0x2b58f2(0xb7))/0x9);if(_0x104635===_0x2c24da)break;else _0x522081['push'](_0x522081['shift']());}catch(_0x196aa3){_0x522081['push'](_0x522081['shift']());}}}(a6_0x452b,0xb524b));export const TOOL_NAMES={'EDIT_FILE':a6_0x452d7(0xb4),'CODEBASE_SEARCH':a6_0x452d7(0xb3),'GITHUB_CODEBASE_SEARCH':'github_codebase_search'};export const ALL_TOOL_NAMES=Object[a6_0x452d7(0xb6)](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.171",
3
+ "version": "0.8.173",
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)",