@morphllm/morphmcp 0.8.180 → 0.8.182
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 +1 -1
- package/dist/log-utils.js +1 -1
- package/dist/logger.js +1 -1
- package/dist/path-utils.js +1 -1
- package/dist/path-validation.js +1 -1
- package/dist/roots-utils.js +1 -1
- package/dist/tool-definitions.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const a0_0x50aede=a0_0xa12a;(function(_0x52d251,_0x4c29c0){const _0x3f4185=a0_0xa12a,_0x1f85f8=_0x52d251();while(!![]){try{const _0x43bcdb=-parseInt(_0x3f4185(0x23a))/0x1+-parseInt(_0x3f4185(0x157))/0x2*(parseInt(_0x3f4185(0x186))/0x3)+parseInt(_0x3f4185(0x249))/0x4*(parseInt(_0x3f4185(0x22c))/0x5)+-parseInt(_0x3f4185(0x143))/0x6*(-parseInt(_0x3f4185(0x20c))/0x7)+-parseInt(_0x3f4185(0x153))/0x8*(parseInt(_0x3f4185(0x264))/0x9)+parseInt(_0x3f4185(0x1ec))/0xa*(parseInt(_0x3f4185(0x152))/0xb)+-parseInt(_0x3f4185(0x180))/0xc;if(_0x43bcdb===_0x4c29c0)break;else _0x1f85f8['push'](_0x1f85f8['shift']());}catch(_0x4ca6f9){_0x1f85f8['push'](_0x1f85f8['shift']());}}}(a0_0x3bac,0xb2a3e));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_0x5237c2 from'fs/promises';import a0_0x20fcf1 from'path';import a0_0x20d132 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_0x38920b from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x34efbb){const _0x48c177=a0_0xa12a,_0x5189e9=_0x34efbb['split'](a0_0x20fcf1['sep'])[_0x48c177(0x204)](Boolean);if(_0x5189e9[_0x48c177(0x1eb)]<0x2)return null;for(let _0x15b6b6=Math['floor'](_0x5189e9[_0x48c177(0x1eb)]/0x2);_0x15b6b6>=0x1;_0x15b6b6--){for(let _0x3974d5=0x0;_0x3974d5<=_0x5189e9['length']-0x2*_0x15b6b6;_0x3974d5++){const _0x3d2d2e=_0x5189e9['slice'](_0x3974d5,_0x3974d5+_0x15b6b6),_0xf9cf29=_0x5189e9[_0x48c177(0x1cc)](_0x3974d5+_0x15b6b6,_0x3974d5+0x2*_0x15b6b6);if(_0x3d2d2e[_0x48c177(0x1b2)]((_0x181fde,_0x4e328e)=>_0x181fde===_0xf9cf29[_0x4e328e])){const _0x2b208b=[..._0x5189e9[_0x48c177(0x1cc)](0x0,_0x3974d5),..._0x5189e9[_0x48c177(0x1cc)](_0x3974d5+_0x15b6b6)];return a0_0x20fcf1[_0x48c177(0x185)]+_0x2b208b['join'](a0_0x20fcf1[_0x48c177(0x185)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x1daa23=a0_0xa12a;try{const _0x55b2a2=require('../package.json');return _0x55b2a2[_0x1daa23(0x167)]??_0x1daa23(0x1f8);}catch(_0x93a857){return logMcpStderr(_0x1daa23(0x224),_0x93a857),_0x1daa23(0x1f8);}}function printHelp(){const _0x20f751=a0_0xa12a;console[_0x20f751(0x1db)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x20f751(0x1db)](_0x20f751(0x1cd)),console[_0x20f751(0x1db)]('\x0aOptions:'),console[_0x20f751(0x1db)](_0x20f751(0x236)),console[_0x20f751(0x1db)](_0x20f751(0x1a3)),console[_0x20f751(0x1db)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x20f751(0x1db)](_0x20f751(0x1de)),console[_0x20f751(0x1db)](_0x20f751(0x191)),console[_0x20f751(0x1db)](_0x20f751(0x1fe));}const cliArgs=process[a0_0x50aede(0x1af)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x50aede(0x222),'-v','-V']),HELP_FLAGS=new Set([a0_0x50aede(0x154),'-h']);cliArgs[a0_0x50aede(0x259)](_0x5a01c3=>VERSION_FLAGS[a0_0x50aede(0x1b6)](_0x5a01c3))&&(console[a0_0x50aede(0x1db)]('@morphllm/morphmcp\x20'+getPackageVersion()),process['exit'](0x0));cliArgs['some'](_0x17990d=>HELP_FLAGS[a0_0x50aede(0x1b6)](_0x17990d))&&(printHelp(),process[a0_0x50aede(0x21e)](0x0));function getCliArg(_0x3f8676){const _0x54eea5=a0_0x50aede;for(let _0x3691b2=0x0;_0x3691b2<cliArgs[_0x54eea5(0x1eb)];_0x3691b2++){const _0x1e5ff4=cliArgs[_0x3691b2];if(_0x1e5ff4[_0x54eea5(0x193)]('--'+_0x3f8676+'='))return _0x1e5ff4[_0x54eea5(0x1cc)](('--'+_0x3f8676+'=')['length']);if(_0x1e5ff4==='--'+_0x3f8676&&_0x3691b2+0x1<cliArgs[_0x54eea5(0x1eb)])return cliArgs[_0x3691b2+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x50aede(0x1b6)](arg))continue;if(arg[a0_0x50aede(0x193)]('--api-key='))continue;if(arg==='--api-key'){i++;continue;}args[a0_0x50aede(0x1e1)](arg);}const WORKSPACE_ROOT=process[a0_0x50aede(0x19b)][a0_0x50aede(0x22b)]||process['env'][a0_0x50aede(0x140)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x50aede(0x19b)][a0_0x50aede(0x16f)]!=='false',MORPH_API_KEY=getCliArg(a0_0x50aede(0x15d))??process[a0_0x50aede(0x19b)][a0_0x50aede(0x1cf)],MORPH_API_URL=process[a0_0x50aede(0x19b)][a0_0x50aede(0x1ed)],MORPH_LARGE_APPLY=process[a0_0x50aede(0x19b)]['MORPH_LARGE_APPLY']!==a0_0x50aede(0x156),MORPH_WARP_GREP_TIMEOUT=process['env']['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x50aede(0x19b)][a0_0x50aede(0x218)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x50aede(0x19b)]['DISABLED_TOOLS']?new Set(process[a0_0x50aede(0x19b)][a0_0x50aede(0x21c)]['split'](',')['map'](_0x218205=>_0x218205[a0_0x50aede(0x1c9)]())[a0_0x50aede(0x204)](_0x5b024b=>_0x5b024b[a0_0x50aede(0x1eb)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x50aede(0x1f5)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x50aede(0x1b6)](tool)&&console[a0_0x50aede(0x184)](a0_0x50aede(0x221)+tool+a0_0x50aede(0x247)+[...KNOWN_TOOL_NAMES][a0_0x50aede(0x1e8)](',\x20'));}console[a0_0x50aede(0x184)](a0_0x50aede(0x161)+[...DISABLED_TOOLS][a0_0x50aede(0x1e8)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x50aede(0x193)](a0_0x50aede(0x244))&&!MORPH_API_KEY['startsWith']('morph-')&&logMcpStderr(a0_0x50aede(0x252));async function reportMorphError(_0x33f7c0){const _0x3b53e2=a0_0x50aede;try{await a0_0x38920b['post'](_0x3b53e2(0x183),{..._0x33f7c0,'timestamp':new Date()[_0x3b53e2(0x19f)](),'source':_0x33f7c0[_0x3b53e2(0x20e)]||_0x3b53e2(0x23e),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x33f7c0[_0x3b53e2(0x23c)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x3b53e2(0x1a4),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}function a0_0x3bac(){const _0x21badf=['substring','filter','.vscode','metadata','\x20-\x20','indexOf','oninitialized','Use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code\x20blocks.\x20Include\x20just\x20enough\x20surrounding\x20context\x20to\x20locate\x20each\x20edit\x20precisely.\x0a\x0a','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','5491647dRWCyn','description','source','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a',',\x20modified\x20','[github_codebase_search]\x20Failed\x20in\x20','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','\x20error(s)','composer.json','tool','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','\x20chars)','MORPH_WARP_GREP_TIMEOUT','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','completed','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','DISABLED_TOOLS','github_codebase_search','exit','realpath','FileNotFound','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','--version','warp_grep_complete','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','unknown\x20error','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.','file_read_failed','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','-\x20Grepped\x20\x27','Created\x20File','WORKSPACE_ROOT','35pdTERQ','files','search_type','lines','stringify','[github_codebase_search]\x20Done\x20in\x20','RipgrepNotAvailable','WarpGrep\x20sub-tool\x20errors:\x20','status','messages','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','payload','WarpGrepError','tool_call_error','1155924IxGaUX','stack','context','string','mcp-filesystem','BinaryFile','access','resolve','repo_path','constructor','sk-','Parent\x20directory\x20does\x20not\x20exist:\x20','read','\x22.\x20Known\x20tools:\x20','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','809696nnmShd','edit_file','go.mod','\x20valid\x20directories','grep','tool_calls','Fallback:\x20Using\x20workspace\x20root\x20','list_directory','❌\x20Morph\x20Edit\x20Failed:\x20','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','compaction_failed','Warning:\x20Workspace\x20fallback\x20failed:\x20','EDIT_FILE','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','filePath','morph-','some','Tool\x20','-\x20Listed\x20directory\x20`','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','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.','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','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.','boolean','isArray','0.2.0','listRoots','207BZgVgZ','changes','message','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','PWD','path_validation_start','ReadError','6ODYFlq','target_file',',\x20removed\x20','FileReadError','\x22>\x0aError\x20reading\x20file:\x20','node_modules','\x22>\x0a','morph-v3-fast','Error\x20running\x20fast\x20context\x20search:\x20','code_edit','morph-warp-grep-v2.1','name','number','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','toLowerCase','33vBydfH','54152BlGxAZ','--help','Invalid\x20arguments:\x20','false','93914BSKWzh','glob','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Morph\x20Edit\x20','Unknown\x20error','instructions','api-key','command','response','tool_call_complete','Disabled\x20tools:\x20','branch','map','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.','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','version','morph-v3-large','inputSchema','RipgrepError','all','match','isDirectory','errors','ENABLE_WORKSPACE_MODE','params','setRequestHandler','CODEBASE_SEARCH','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','etimedout','tool_call_received','timed\x20out','text','ms:','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','glob\x20\x27','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','now','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','min','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.','7683408CiMpSU','role','roots','https://morphllm.com/api/error-report','error','sep','33RQRCjl','instruction','Max\x20results\x20to\x20return','morph-mcp','grep_search','Error\x20accessing\x20directory\x20','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','catch','api_request_start','split','searchGitHub','\x20\x20morph-mcp','provider_created','startsWith','arguments','data','default','SymlinkError','-\x20Read\x20file\x20`','search_string','pattern','env','linesRemoved','.git','basename','toISOString','code','\x0a...\x20(truncated,\x20total:\x20','function','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','application/json','-\x20Preserve\x20exact\x20indentation\x0a','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','\x27\x20in\x20`','finish','setNotificationHandler','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','\x20as\x20allowed\x20directory','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','ms.\x20Success:\x20','file_path','argv','[could\x20not\x20read\x20file:\x20','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','every','homedir','Preview\x20changes\x20without\x20applying\x20them.','Example\x20format:\x0a','has','tool_call_id','MCP','content','assistant','completionId','user','Workspace\x20mode\x20enabled:\x20Using\x20','timings','completed_with_file_errors','list_directory\x20','object','terminationReason','debug','dryRun','safeParse','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','GitHub\x20search\x20failed:\x20','dirname','trim','readFile','file','slice','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','path','MORPH_API_KEY','\x0a</file>','includes','UnknownError','file_read_complete','Unknown\x20tool:\x20','success','API\x20error\x20(auth/rate-limit)','linesModified','warn','Error:\x20','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','log','requiresApiKey','path_validation_resolved','\x0aExamples:','Tool\x20\x22','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','push','utf-8','Warning:\x20','ENOENT','runWarpGrep_call','Here\x20is\x20the\x20content\x20of\x20files:\x0a','.\x20Path:\x20','join','codebase_search','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','length','3328810UGgjBH','MORPH_API_URL','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','Parameters:\x0a','.\x20Changes:\x20','linesAdded','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','github_url','new_string','size','optional','Repository\x20identifier','unknown','edit','describe','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','tsconfig.json','TimeoutError','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Morph\x20FastApply\x20failed\x20without\x20error\x20message','timeout','<file\x20path=\x22'];a0_0x3bac=function(){return _0x21badf;};return a0_0x3bac();}function extractStatusCode(_0x30de50,_0x42dc7d){const _0x68eb49=a0_0x50aede;if(_0x30de50&&typeof _0x30de50==='object'&&'status'in _0x30de50)return _0x30de50[_0x68eb49(0x234)];if(_0x30de50&&typeof _0x30de50===_0x68eb49(0x1c1)&&'response'in _0x30de50)return _0x30de50[_0x68eb49(0x15f)]?.[_0x68eb49(0x234)];const _0x71f65c=_0x42dc7d[_0x68eb49(0x16c)](/\b(401|429)\b/);return _0x71f65c?parseInt(_0x71f65c[0x1],0xa):null;}function a0_0xa12a(_0x52770a,_0x2e912f){_0x52770a=_0x52770a-0x13d;const _0x3bac17=a0_0x3bac();let _0xa12acf=_0x3bac17[_0x52770a];return _0xa12acf;}function handleMorphAPIError(_0x6093a2){const _0xfc9775=a0_0x50aede,_0x259be3=_0x6093a2 instanceof Error?_0x6093a2[_0xfc9775(0x13e)]:String(_0x6093a2),_0x2f3977=extractStatusCode(_0x6093a2,_0x259be3);switch(_0x2f3977){case 0x191:return{'content':[{'type':_0xfc9775(0x177),'text':_0xfc9775(0x17f)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0xfc9775(0x177),'text':_0xfc9775(0x228)}],'isError':!![]};default:return null;}}args[a0_0x50aede(0x1eb)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x50aede(0x1c6)),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr(a0_0x50aede(0x17d)),logMcpStderr(a0_0x50aede(0x212)),logMcpStderr(a0_0x50aede(0x256)),logMcpStderr(a0_0x50aede(0x21b)));function normalizePath(_0x5d41b7){return a0_0x20fcf1['normalize'](_0x5d41b7);}function expandHome(_0x1fe926){const _0x5986e3=a0_0x50aede;if(_0x1fe926['startsWith']('~/')||_0x1fe926==='~')return a0_0x20fcf1[_0x5986e3(0x1e8)](a0_0x20d132[_0x5986e3(0x1b3)](),_0x1fe926[_0x5986e3(0x1cc)](0x1));return _0x1fe926;}let allowedDirectories=await Promise[a0_0x50aede(0x16b)](args[a0_0x50aede(0x163)](async _0x21aba1=>{const _0x349caa=a0_0x50aede,_0x3591d0=expandHome(_0x21aba1),_0x492365=a0_0x20fcf1[_0x349caa(0x241)](_0x3591d0);try{const _0xe118bf=await a0_0x5237c2[_0x349caa(0x21f)](_0x492365);return normalizePath(_0xe118bf);}catch(_0x54b4c0){return normalizePath(_0x492365);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x50aede(0x1eb)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x50aede(0x1e1)](workspaceDir),logMcpStderr(a0_0x50aede(0x1bd)+workspaceDir+a0_0x50aede(0x1ab)));}catch(a0_0x1c040f){logMcpStderr(a0_0x50aede(0x1fb)+a0_0x1c040f);}async function detectWorkspaceRoot(_0x343c35){const _0x575a89=a0_0x50aede;let _0x4121c3=a0_0x20fcf1[_0x575a89(0x241)](_0x343c35);const _0x276597=[_0x575a89(0x19d),_0x575a89(0x205),'package.json','Cargo.toml','pyproject.toml',_0x575a89(0x24b),'.cursor',_0x575a89(0x1fc),_0x575a89(0x214)];while(_0x4121c3!==a0_0x20fcf1[_0x575a89(0x1c8)](_0x4121c3)){for(const _0x1a343b of _0x276597){const _0x26a88f=a0_0x20fcf1[_0x575a89(0x1e8)](_0x4121c3,_0x1a343b);try{return await a0_0x5237c2[_0x575a89(0x240)](_0x26a88f),normalizePath(_0x4121c3);}catch{}}_0x4121c3=a0_0x20fcf1[_0x575a89(0x1c8)](_0x4121c3);}return normalizePath(_0x343c35);}await Promise[a0_0x50aede(0x16b)](args[a0_0x50aede(0x163)](async _0x5bc67f=>{const _0x57c185=a0_0x50aede;try{const _0x5edf2b=await a0_0x5237c2['stat'](expandHome(_0x5bc67f));!_0x5edf2b[_0x57c185(0x16d)]()&&(logMcpStderr(_0x57c185(0x1d9)+_0x5bc67f+'\x20is\x20not\x20a\x20directory'),process[_0x57c185(0x21e)](0x1));}catch(_0x20b24c){logMcpStderr(_0x57c185(0x18b)+_0x5bc67f+':',_0x20b24c),process['exit'](0x1);}}));async function validatePath(_0x295ed4){const _0x38d557=a0_0x50aede,_0x32132d=expandHome(_0x295ed4),_0x5a4097=a0_0x20fcf1[_0x38d557(0x241)](_0x32132d);logger['debug'](_0x38d557(0x1b8),_0x38d557(0x141),{'raw_path':_0x295ed4,'absolute':_0x5a4097});try{const _0x115f5e=await a0_0x5237c2[_0x38d557(0x21f)](_0x5a4097);return logger['debug'](_0x38d557(0x1b8),_0x38d557(0x1dd),{'resolved':_0x115f5e,'symlink':_0x115f5e!==_0x5a4097}),_0x115f5e;}catch(_0xbcf01a){if(_0xbcf01a['code']===_0x38d557(0x1e4)){const _0x2973c8=a0_0x20fcf1[_0x38d557(0x1c8)](_0x5a4097);try{const _0x903617=await a0_0x5237c2[_0x38d557(0x21f)](_0x2973c8),_0xb960cf=a0_0x20fcf1[_0x38d557(0x1e8)](_0x903617,a0_0x20fcf1[_0x38d557(0x19e)](_0x5a4097));return logger[_0x38d557(0x1c3)](_0x38d557(0x1b8),_0x38d557(0x1dd),{'resolved':_0xb960cf,'new_file':!![]}),_0xb960cf;}catch{logger[_0x38d557(0x184)](_0x38d557(0x1b8),'path_validation_failed',{'raw_path':_0x295ed4,'error':'Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x2973c8});throw new Error(_0x38d557(0x245)+_0x2973c8);}}logger[_0x38d557(0x184)](_0x38d557(0x1b8),'path_validation_failed',{'raw_path':_0x295ed4,'error':_0xbcf01a[_0x38d557(0x13e)]});throw _0xbcf01a;}}const MorphEditFileArgsSchema=z[a0_0x50aede(0x1c1)]({'path':z[a0_0x50aede(0x23d)](),'code_edit':z['string']()[a0_0x50aede(0x1fa)](a0_0x50aede(0x1ee)),'instruction':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1fa)](a0_0x50aede(0x1f2)),'dryRun':z[a0_0x50aede(0x260)]()[a0_0x50aede(0x196)](![])[a0_0x50aede(0x1fa)](a0_0x50aede(0x1b4))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x50aede(0x25d),WarpGrepArgsSchema=z[a0_0x50aede(0x1c1)]({'search_string':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1fa)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x50aede(0x23d)]()['describe']('The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos'),'search_type':z['enum']([a0_0x50aede(0x196),a0_0x50aede(0x148)])[a0_0x50aede(0x1f6)]()[a0_0x50aede(0x1fa)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z[a0_0x50aede(0x1c1)]({'search_string':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1fa)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x50aede(0x23d)]()['optional']()['describe'](a0_0x50aede(0x25f)),'owner_repo':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1f6)]()[a0_0x50aede(0x1fa)](a0_0x50aede(0x1da)),'branch':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1f6)]()['describe'](a0_0x50aede(0x1a6))}),CodebaseSearchArgsSchema=z[a0_0x50aede(0x1c1)]({'query':z[a0_0x50aede(0x23d)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()['describe'](a0_0x50aede(0x1f7)),'branch':z['string']()[a0_0x50aede(0x1f6)]()['describe'](a0_0x50aede(0x173)),'commitHash':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1f6)]()[a0_0x50aede(0x1fa)]('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z['array'](z[a0_0x50aede(0x23d)]())['default']([])[a0_0x50aede(0x1fa)](a0_0x50aede(0x159)),'limit':z[a0_0x50aede(0x14f)]()['optional']()[a0_0x50aede(0x196)](0xa)[a0_0x50aede(0x1fa)](a0_0x50aede(0x188))}),server=new Server({'name':a0_0x50aede(0x189),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x50aede(0x171)](ListToolsRequestSchema,async()=>{const _0x28f2d9=a0_0x50aede,_0x9cfce2=[{'name':TOOL_NAMES[_0x28f2d9(0x255)],'description':_0x28f2d9(0x20f)+_0x28f2d9(0x1ef)+_0x28f2d9(0x13f)+_0x28f2d9(0x1b1)+_0x28f2d9(0x248)+_0x28f2d9(0x20a)+_0x28f2d9(0x1b5)+'//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a'+'Rules:\x0a'+'-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a'+_0x28f2d9(0x1a5)+'-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a'+_0x28f2d9(0x165),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x28f2d9(0x172)],'description':_0x28f2d9(0x219)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x28f2d9(0x1e0)+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x3e393d=_0x9cfce2[_0x28f2d9(0x204)](_0x3118d4=>{const _0xd93567=_0x28f2d9;if(DISABLED_TOOLS[_0xd93567(0x1b6)](_0x3118d4['name']))return console[_0xd93567(0x184)](_0xd93567(0x25a)+_0x3118d4[_0xd93567(0x14e)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0xd93567(0x1dc)in _0x3118d4&&_0x3118d4['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0xd93567(0x1e3)+_0x3118d4[_0xd93567(0x14e)]+_0xd93567(0x1aa)),![];return!![];});return{'tools':_0x3e393d['map'](_0x1054ef=>({'name':_0x1054ef[_0x28f2d9(0x14e)],'description':_0x1054ef[_0x28f2d9(0x20d)],'inputSchema':_0x1054ef[_0x28f2d9(0x169)]}))};}),server[a0_0x50aede(0x171)](CallToolRequestSchema,async _0x12a6be=>{const _0x367870=a0_0x50aede,{name:_0x39e5ba,arguments:_0x2c41b8}=_0x12a6be[_0x367870(0x170)],_0x32b9cc=Date[_0x367870(0x17c)]();logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x175),{'tool':_0x39e5ba,'args':_0x39e5ba==='edit_file'?{'path':_0x2c41b8?.[_0x367870(0x1ce)],'instruction':_0x2c41b8?.[_0x367870(0x187)]||_0x2c41b8?.[_0x367870(0x15c)],'dryRun':_0x2c41b8?.[_0x367870(0x1c4)]}:_0x2c41b8});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x166)}],'isError':!![]};if(!MORPH_API_KEY['startsWith'](_0x367870(0x244))&&!MORPH_API_KEY[_0x367870(0x193)](_0x367870(0x258)))return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x226)}],'isError':!![]};if(DISABLED_TOOLS[_0x367870(0x1b6)](_0x39e5ba))return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x1df)+_0x39e5ba+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x39e5ba){case TOOL_NAMES[_0x367870(0x255)]:{let _0x2d7e95=_0x2c41b8;if(_0x2d7e95&&typeof _0x2d7e95===_0x367870(0x1c1)){if(!('path'in _0x2d7e95)){const _0x1d14f4=_0x2d7e95[_0x367870(0x144)]??_0x2d7e95[_0x367870(0x257)]??_0x2d7e95['target_filepath']??_0x2d7e95[_0x367870(0x1ae)]??_0x2d7e95[_0x367870(0x1cb)];if(_0x1d14f4)_0x2d7e95={..._0x2d7e95,'path':_0x1d14f4};}_0x367870(0x15c)in _0x2d7e95&&!(_0x367870(0x187)in _0x2d7e95)&&(_0x2d7e95={..._0x2d7e95,'instruction':_0x2d7e95[_0x367870(0x15c)]});if(!(_0x367870(0x14c)in _0x2d7e95)){const _0x19b26e=_0x2d7e95[_0x367870(0x1a0)]??_0x2d7e95[_0x367870(0x1f4)]??_0x2d7e95['content']??_0x2d7e95[_0x367870(0x1f9)];if(_0x19b26e)_0x2d7e95={..._0x2d7e95,'code_edit':_0x19b26e};}}const _0x52f74c=MorphEditFileArgsSchema[_0x367870(0x1c5)](_0x2d7e95);if(!_0x52f74c[_0x367870(0x1d5)])throw new Error(_0x367870(0x150)+_0x52f74c[_0x367870(0x184)]);const _0x5ebd9a=await validatePath(_0x52f74c[_0x367870(0x195)]['path']);let _0x485029=null,_0x33603c=!![],_0x4e56bc=null;try{_0x485029=await a0_0x5237c2[_0x367870(0x1ca)](_0x5ebd9a,_0x367870(0x1e2)),logger['debug'](_0x367870(0x1b8),_0x367870(0x1d3),{'path':_0x5ebd9a,'size_bytes':_0x485029[_0x367870(0x1eb)]});}catch(_0x4ebf4f){const _0x6b9b42=_0x4ebf4f[_0x367870(0x1a0)];_0x6b9b42===_0x367870(0x1e4)?(_0x33603c=![],_0x485029='',logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x1d3),{'path':_0x5ebd9a,'exists':![]})):(_0x4e56bc='Failed\x20to\x20read\x20file:\x20'+(_0x6b9b42||_0x367870(0x1f8))+_0x367870(0x207)+(_0x4ebf4f instanceof Error?_0x4ebf4f['message']:String(_0x4ebf4f)),logger['error'](_0x367870(0x1b8),_0x367870(0x227),{'path':_0x5ebd9a,'error':_0x4e56bc}),logMcpStderr(_0x367870(0x1e3)+_0x4e56bc));}let _0x7413e;try{const _0x2e36fe=MORPH_API_KEY;if(!_0x2e36fe)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x11cbab=a0_0x20fcf1['dirname'](_0x5ebd9a),_0x285d8f=a0_0x20fcf1[_0x367870(0x19e)](_0x5ebd9a);logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x18e),{'model':_0x367870(0x14a),'path':_0x52f74c[_0x367870(0x195)][_0x367870(0x1ce)],'instruction_len':_0x52f74c[_0x367870(0x195)][_0x367870(0x187)]['length'],'code_edit_len':_0x52f74c['data'][_0x367870(0x14c)][_0x367870(0x1eb)],'original_code_len':_0x485029?.[_0x367870(0x1eb)]??0x0,'dry_run':_0x52f74c[_0x367870(0x195)][_0x367870(0x1c4)]});const _0x2d480b=Date['now'](),_0x580e5d=await executeEditFile({'target_filepath':_0x285d8f,'code_edit':_0x52f74c[_0x367870(0x195)][_0x367870(0x14c)],'instruction':_0x52f74c[_0x367870(0x195)][_0x367870(0x187)]},{'morphApiKey':_0x2e36fe,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x11cbab,'autoWrite':!_0x52f74c[_0x367870(0x195)][_0x367870(0x1c4)],'generateUdiff':![],'debug':![]}),_0x89f152=Date['now']()-_0x2d480b;_0x7413e=_0x580e5d[_0x367870(0x1bb)];if(!_0x580e5d[_0x367870(0x1d5)])throw new Error(_0x580e5d[_0x367870(0x184)]||_0x367870(0x200));const _0x5bb124=_0x580e5d[_0x367870(0x13d)],_0x4fab8d='added\x20'+_0x5bb124[_0x367870(0x1f1)]+_0x367870(0x145)+_0x5bb124[_0x367870(0x19c)]+_0x367870(0x210)+_0x5bb124['linesModified'];logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x160),{'tool':_0x367870(0x24a),'success':!![],'latency_ms':Date[_0x367870(0x17c)]()-_0x32b9cc,'edit_latency_ms':_0x89f152,'changes':{'added':_0x5bb124[_0x367870(0x1f1)],'removed':_0x5bb124[_0x367870(0x19c)],'modified':_0x5bb124[_0x367870(0x1d7)]},'completion_id':_0x7413e});if(_0x52f74c[_0x367870(0x195)]['dryRun'])return{'content':[{'type':_0x367870(0x177),'text':'Morph\x20Edit\x20Preview'+(_0x33603c?'':'\x20(new\x20file)')+':\x20'+_0x52f74c['data'][_0x367870(0x187)]+_0x367870(0x1f0)+_0x4fab8d+_0x367870(0x1e7)+_0x52f74c[_0x367870(0x195)][_0x367870(0x1ce)]+'.'}]};return{'content':[{'type':'text','text':_0x367870(0x15a)+(_0x33603c?'Applied':_0x367870(0x22a))+':\x20'+_0x52f74c['data'][_0x367870(0x187)]+_0x367870(0x1f0)+_0x4fab8d+'.\x20Path:\x20'+_0x52f74c[_0x367870(0x195)][_0x367870(0x1ce)]+'.'}]};}catch(_0x1233d7){const _0x10e89b=handleMorphAPIError(_0x1233d7);if(_0x10e89b)return logger[_0x367870(0x184)](_0x367870(0x1b8),_0x367870(0x239),{'tool':_0x367870(0x24a),'error':_0x367870(0x1d6),'latency_ms':Date[_0x367870(0x17c)]()-_0x32b9cc}),_0x10e89b;const _0x49423f=_0x1233d7 instanceof Error?_0x1233d7[_0x367870(0x13e)]:String(_0x1233d7);return logger['error'](_0x367870(0x1b8),'tool_call_error',{'tool':_0x367870(0x24a),'error':_0x49423f,'path':_0x52f74c['data']['path'],'validated_path':_0x5ebd9a,'latency_ms':Date[_0x367870(0x17c)]()-_0x32b9cc,'stack':_0x1233d7 instanceof Error?_0x1233d7[_0x367870(0x23b)]:undefined}),reportMorphError({'error_message':_0x49423f,'error_type':_0x1233d7 instanceof Error?_0x1233d7['constructor'][_0x367870(0x14e)]:_0x367870(0x1d2),'context':{'tool':_0x367870(0x24a),'completion_id':_0x7413e,'file_path':_0x52f74c['data'][_0x367870(0x1ce)],'validated_path':_0x5ebd9a,'instruction':_0x52f74c['data']['instruction'],'model':MORPH_LARGE_APPLY?_0x367870(0x168):_0x367870(0x14a),'dry_run':_0x52f74c['data']['dryRun'],'file_exists':_0x33603c,'file_read_error':_0x4e56bc,'file_readable':_0x485029!==null,'request_content':{'path':_0x52f74c[_0x367870(0x195)][_0x367870(0x1ce)],'code_edit':_0x52f74c[_0x367870(0x195)][_0x367870(0x14c)],'instruction':_0x52f74c['data']['instruction'],'original_code':_0x485029!==null?_0x485029[_0x367870(0x1eb)]>0xc350?_0x485029[_0x367870(0x203)](0x0,0xc350)+_0x367870(0x1a1)+_0x485029[_0x367870(0x1eb)]+_0x367870(0x217):_0x485029:_0x367870(0x1b0)+(_0x4e56bc||_0x367870(0x225))+']','original_code_length':_0x485029?.[_0x367870(0x1eb)]??0x0,'model':MORPH_LARGE_APPLY?_0x367870(0x168):'morph-v3-fast','dry_run':_0x52f74c[_0x367870(0x195)][_0x367870(0x1c4)]}},'stack_trace':_0x1233d7 instanceof Error?_0x1233d7[_0x367870(0x23b)]:undefined,'source':'mcp-filesystem'})[_0x367870(0x18d)](()=>{}),{'content':[{'type':'text','text':_0x367870(0x251)+_0x49423f}],'isError':!![]};}}case TOOL_NAMES['CODEBASE_SEARCH']:{const _0x3d8421=WarpGrepArgsSchema['safeParse'](_0x2c41b8);if(!_0x3d8421[_0x367870(0x1d5)])return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x155)+_0x3d8421['error']}],'isError':!![]};const _0x4a5946=_0x45dc90=>{const _0x1450f8=_0x367870,_0x4e71d3=[];for(const _0x5e9e8f of _0x45dc90||[]){if(_0x5e9e8f[_0x1450f8(0x181)]===_0x1450f8(0x1ba)&&Array[_0x1450f8(0x261)](_0x5e9e8f[_0x1450f8(0x24e)]))for(const _0x5a2c19 of _0x5e9e8f['tool_calls']){try{const _0x5ef070=_0x5a2c19[_0x1450f8(0x1a2)]?.[_0x1450f8(0x14e)],_0x47a80f=JSON['parse'](_0x5a2c19['function']?.[_0x1450f8(0x194)]||'{}');if(_0x5ef070==='grep_search')_0x4e71d3[_0x1450f8(0x1e1)]('grep\x20\x27'+_0x47a80f[_0x1450f8(0x19a)]+'\x27\x20'+(_0x47a80f['path']||'.'));else{if(_0x5ef070==='read')_0x4e71d3[_0x1450f8(0x1e1)]('read\x20'+_0x47a80f[_0x1450f8(0x1ce)]);else{if(_0x5ef070===_0x1450f8(0x250))_0x4e71d3['push'](_0x1450f8(0x1c0)+(_0x47a80f[_0x1450f8(0x15e)]||'.'));else{if(_0x5ef070===_0x1450f8(0x158))_0x4e71d3[_0x1450f8(0x1e1)](_0x1450f8(0x17a)+_0x47a80f[_0x1450f8(0x19a)]+'\x27\x20'+(_0x47a80f[_0x1450f8(0x1ce)]||'.'));else _0x5ef070==='finish'&&_0x4e71d3[_0x1450f8(0x1e1)](_0x1450f8(0x1a8));}}}}catch{}}}return _0x4e71d3;},_0x4e686f=_0x36560f=>{const _0x2657d7=_0x367870,_0xe32c46=[];if(!_0x36560f||!Array[_0x2657d7(0x261)](_0x36560f))return _0xe32c46;const _0x4e27fd=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x2657d7(0x220),'tool':_0x2657d7(0x246)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x2657d7(0x246)},{'pattern':/\[READ ERROR\]/,'error_type':_0x2657d7(0x142),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x2657d7(0x246)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x2657d7(0x16a),'tool':_0x2657d7(0x24d)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x2657d7(0x232),'tool':_0x2657d7(0x24d)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x2657d7(0x23f),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':'read'},{'pattern':/not a text file/,'error_type':_0x2657d7(0x23f),'tool':'read'},{'pattern':/symbolic link/,'error_type':_0x2657d7(0x197),'tool':_0x2657d7(0x246)},{'pattern':/Error reading file:/,'error_type':_0x2657d7(0x142),'tool':'read'},{'pattern':/status="error"/,'error_type':'ToolException','tool':'unknown'}];let _0x28bb96=0x0;for(const _0x23d707 of _0x36560f){_0x23d707[_0x2657d7(0x181)]==='assistant'&&Array['isArray'](_0x23d707[_0x2657d7(0x24e)])&&_0x28bb96++;const _0x19f99b=_0x23d707['content'];if((_0x23d707['role']===_0x2657d7(0x215)||_0x23d707[_0x2657d7(0x181)]===_0x2657d7(0x1bc))&&_0x19f99b&&typeof _0x19f99b===_0x2657d7(0x23d))for(const {pattern:_0x199604,error_type:_0x4c00b4,tool:_0xc39334}of _0x4e27fd){const _0x40edf5=_0x19f99b[_0x2657d7(0x16c)](new RegExp(_0x199604[_0x2657d7(0x20e)],'g'));if(_0x40edf5)for(const _0x5c6c8b of _0x40edf5){const _0x74ddc7=_0x19f99b[_0x2657d7(0x208)](_0x5c6c8b),_0x193646=_0x19f99b[_0x2657d7(0x203)](_0x74ddc7,Math[_0x2657d7(0x17e)](_0x74ddc7+0xc8,_0x19f99b[_0x2657d7(0x1eb)]));_0xe32c46[_0x2657d7(0x1e1)]({'tool':_0xc39334,'error_type':_0x4c00b4,'error_message':_0x193646[_0x2657d7(0x18f)]('\x0a')[0x0],'turn':_0x28bb96});}}}return _0xe32c46;};try{const _0x1342d8=a0_0x20fcf1[_0x367870(0x241)](_0x3d8421['data'][_0x367870(0x242)]),_0x4e1133=_0x3d8421[_0x367870(0x195)][_0x367870(0x22e)],_0x1eed7d=_0x4e1133===_0x367870(0x148)?{'allowNames':[_0x367870(0x148)]}:undefined,_0x1a7a14=new LocalRipgrepProvider(_0x1342d8,undefined,_0x1eed7d);logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x192),{'type':'LocalRipgrepProvider','repo_root':_0x1342d8,'search_type':_0x4e1133||_0x367870(0x196)}),logger['debug'](_0x367870(0x1b8),'warp_grep_start',{'query':_0x3d8421['data'][_0x367870(0x199)],'repo_root':_0x1342d8,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x808e76=Date[_0x367870(0x17c)](),_0x4bae9b=await runWarpGrep({'searchTerm':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'repoRoot':_0x1342d8,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x1a7a14,'search_type':_0x4e1133}),_0x2580d0=Date[_0x367870(0x17c)]()-_0x808e76,_0x2afa31=_0x4bae9b[_0x367870(0x1a8)]?.[_0x367870(0x206)]?.[_0x367870(0x22d)]?.[_0x367870(0x1eb)]??0x0;logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x223),{'termination':_0x4bae9b[_0x367870(0x1c2)],'turns':_0x4bae9b[_0x367870(0x1be)]?.['turns']??0x0,'files_found':_0x2afa31,'latency_ms':_0x2580d0});const _0x1807b1=_0x4e686f(_0x4bae9b[_0x367870(0x235)]);_0x1807b1[_0x367870(0x1eb)]>0x0&&reportMorphError({'error_message':_0x367870(0x233)+_0x1807b1['length']+_0x367870(0x213),'error_type':'SubToolError','level':_0x367870(0x1d8),'tool':_0x367870(0x1e9),'context':{'repo_path':_0x3d8421['data'][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'model':_0x367870(0x14d),'termination_reason':_0x4bae9b[_0x367870(0x1c2)],'sub_tool_errors':_0x1807b1,'timings':_0x4bae9b[_0x367870(0x1be)],'tool_calls':_0x4a5946(_0x4bae9b[_0x367870(0x235)]),'messages':_0x4bae9b[_0x367870(0x235)]?.[_0x367870(0x163)](_0x1ff604=>({'role':_0x1ff604[_0x367870(0x181)],'content':_0x1ff604['content'],..._0x1ff604[_0x367870(0x24e)]?{'tool_calls':_0x1ff604['tool_calls']['length']}:{},..._0x1ff604[_0x367870(0x1b7)]?{'tool_call_id':_0x1ff604[_0x367870(0x1b7)]}:{}}))},'source':_0x367870(0x23e)})['catch'](()=>{});let _0x228bf2='';if(_0x4bae9b['terminationReason']===_0x367870(0x21a)&&_0x4bae9b[_0x367870(0x1a8)]?.[_0x367870(0x206)]?.[_0x367870(0x22d)]){const _0x284cac=_0x4bae9b[_0x367870(0x1a8)][_0x367870(0x206)]['files'];if(_0x284cac[_0x367870(0x1eb)]===0x0)return _0x228bf2=_0x4bae9b[_0x367870(0x1a8)][_0x367870(0x237)]||_0x367870(0x1ea),{'content':[{'type':_0x367870(0x177),'text':_0x228bf2}]};const _0x119d62=[],_0x5e740c=[_0x367870(0x179)];for(const _0x580d1c of _0x4bae9b['messages']){if(_0x580d1c[_0x367870(0x181)]===_0x367870(0x1ba)&&Array[_0x367870(0x261)](_0x580d1c[_0x367870(0x24e)]))for(const _0x33564d of _0x580d1c[_0x367870(0x24e)]){try{const _0x2fed0c=_0x33564d[_0x367870(0x1a2)]?.[_0x367870(0x14e)],_0x1ff2ac=JSON['parse'](_0x33564d[_0x367870(0x1a2)]?.[_0x367870(0x194)]||'{}');if(_0x2fed0c===_0x367870(0x18a))_0x5e740c[_0x367870(0x1e1)](_0x367870(0x229)+_0x1ff2ac[_0x367870(0x19a)]+_0x367870(0x1a7)+(_0x1ff2ac[_0x367870(0x1ce)]||'.')+'`');else{if(_0x2fed0c===_0x367870(0x246))_0x5e740c[_0x367870(0x1e1)](_0x367870(0x198)+_0x1ff2ac['path']+'`');else{if(_0x2fed0c===_0x367870(0x250))_0x5e740c[_0x367870(0x1e1)](_0x367870(0x25b)+(_0x1ff2ac[_0x367870(0x15e)]||'.')+'`');else _0x2fed0c===_0x367870(0x158)&&_0x5e740c['push']('-\x20Glob\x20search\x20`'+_0x1ff2ac[_0x367870(0x19a)]+'`\x20in\x20`'+(_0x1ff2ac['path']||'.')+'`');}}}catch{}}}_0x119d62[_0x367870(0x1e1)](_0x5e740c[_0x367870(0x1e8)]('\x0a'));const _0x1b0c55=['','Relevant\x20context\x20found:'];for(const _0x557667 of _0x284cac){if(_0x557667[_0x367870(0x22f)]==='*')_0x1b0c55[_0x367870(0x1e1)]('-\x20'+_0x557667[_0x367870(0x1ce)]+':*');else{if(Array[_0x367870(0x261)](_0x557667[_0x367870(0x22f)])){const _0x501c22=_0x557667[_0x367870(0x22f)][_0x367870(0x163)](([_0xcb238b,_0x296cac])=>{if(_0xcb238b===_0x296cac)return''+_0xcb238b;return _0xcb238b+'-'+_0x296cac;});_0x1b0c55['push']('-\x20'+_0x557667[_0x367870(0x1ce)]+':'+_0x501c22['join'](','));}else _0x1b0c55['push']('-\x20'+_0x557667[_0x367870(0x1ce)]+':*');}}_0x1b0c55[_0x367870(0x1e1)](''),_0x119d62[_0x367870(0x1e1)](_0x1b0c55[_0x367870(0x1e8)]('\x0a')),_0x119d62[_0x367870(0x1e1)](_0x367870(0x1e6));const _0x28721f=[],_0x1f4112=[];for(const _0x7047ed of _0x284cac){let _0x1d18d4=a0_0x20fcf1[_0x367870(0x241)](_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],_0x7047ed[_0x367870(0x1ce)]),_0x3285d3=null,_0x44bf1b=null;try{_0x3285d3=await a0_0x5237c2[_0x367870(0x1ca)](_0x1d18d4,{'encoding':_0x367870(0x1e2)});}catch(_0x7526e2){const _0x5820b9=fixPathRepetition(_0x1d18d4);if(_0x5820b9)try{_0x3285d3=await a0_0x5237c2[_0x367870(0x1ca)](_0x5820b9,{'encoding':_0x367870(0x1e2)}),_0x1d18d4=_0x5820b9;}catch{_0x44bf1b=_0x7526e2 instanceof Error?_0x7526e2:new Error(String(_0x7526e2));}else _0x44bf1b=_0x7526e2 instanceof Error?_0x7526e2:new Error(String(_0x7526e2));}if(_0x3285d3!==null){const _0x17a628=_0x3285d3[_0x367870(0x18f)](/\r?\n/),_0x118efd=[];if(_0x7047ed[_0x367870(0x22f)]==='*'||!Array[_0x367870(0x261)](_0x7047ed['lines']))for(let _0x3169b3=0x1;_0x3169b3<=_0x17a628[_0x367870(0x1eb)];_0x3169b3++){const _0x6e34ca=_0x17a628[_0x3169b3-0x1];_0x118efd[_0x367870(0x1e1)](_0x3169b3+'|\x20'+_0x6e34ca);}else for(const [_0x84d787,_0x183a87]of _0x7047ed[_0x367870(0x22f)]){_0x118efd[_0x367870(0x1eb)]>0x0&&_0x118efd[_0x367870(0x1e1)]('');for(let _0x4110e5=_0x84d787;_0x4110e5<=_0x183a87&&_0x4110e5<=_0x17a628['length'];_0x4110e5++){const _0xd85615=_0x17a628[_0x4110e5-0x1];_0x118efd[_0x367870(0x1e1)](_0x4110e5+'|\x20'+_0xd85615);}}_0x1f4112[_0x367870(0x1e1)]({'path':_0x7047ed[_0x367870(0x1ce)],'content':_0x118efd['join']('\x0a')});}else _0x28721f['push'](_0x367870(0x202)+_0x7047ed[_0x367870(0x1ce)]+_0x367870(0x147)+(_0x44bf1b?.[_0x367870(0x13e)]||_0x367870(0x15b))+'\x0a</file>');}try{const _0x5ed92c=await compactFileContexts(_0x1f4112,_0x3d8421['data'][_0x367870(0x199)],MORPH_API_KEY,MORPH_API_URL);for(const _0x2fdc12 of _0x5ed92c){_0x28721f[_0x367870(0x1e1)](_0x367870(0x202)+_0x2fdc12[_0x367870(0x1ce)]+'\x22>\x0a'+_0x2fdc12['content']+_0x367870(0x1d0));}}catch(_0x42c63c){logger[_0x367870(0x1d8)](_0x367870(0x1b8),_0x367870(0x253),{'error':_0x42c63c instanceof Error?_0x42c63c[_0x367870(0x13e)]:String(_0x42c63c),'files_count':_0x1f4112[_0x367870(0x1eb)]});for(const _0x3825be of _0x1f4112){_0x28721f[_0x367870(0x1e1)](_0x367870(0x202)+_0x3825be[_0x367870(0x1ce)]+_0x367870(0x149)+_0x3825be['content']+_0x367870(0x1d0));}}_0x119d62['push'](_0x28721f['join']('\x0a\x0a')),_0x228bf2=_0x119d62[_0x367870(0x1e8)]('\x0a');const _0x219e8e=_0x4bae9b[_0x367870(0x16e)]?.[_0x367870(0x204)](_0x389401=>_0x389401[_0x367870(0x13e)]?.[_0x367870(0x193)]('File\x20read\x20error:'))||[];if(_0x219e8e['length']>0x0){const _0xa2a7bb=_0x219e8e['map'](_0x4a4a44=>_0x4a4a44[_0x367870(0x13e)])[_0x367870(0x1e8)](';\x20');reportMorphError({'error_message':_0xa2a7bb,'error_type':_0x367870(0x146),'context':{'tool':_0x367870(0x1e9),'repo_path':_0x3d8421['data'][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'model':_0x367870(0x14d),'termination_reason':_0x367870(0x1bf),'error_count':_0x219e8e[_0x367870(0x1eb)],'is_timeout':![],'timings':_0x4bae9b[_0x367870(0x1be)],'files_attempted':_0x284cac[_0x367870(0x163)](_0x5d02f7=>({'path':_0x5d02f7['path'],'lines':_0x5d02f7[_0x367870(0x22f)]})),'tool_calls':_0x4a5946(_0x4bae9b[_0x367870(0x235)]),'messages':_0x4bae9b[_0x367870(0x235)]?.[_0x367870(0x163)](_0xe3c89c=>({'role':_0xe3c89c['role'],'content':_0xe3c89c[_0x367870(0x1b9)],..._0xe3c89c[_0x367870(0x24e)]?{'tool_calls':_0xe3c89c[_0x367870(0x24e)]['length']}:{},..._0xe3c89c[_0x367870(0x1b7)]?{'tool_call_id':_0xe3c89c[_0x367870(0x1b7)]}:{}})),'request_content':{'query':_0x3d8421['data']['search_string'],'repo_path':_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],'repoRoot':a0_0x20fcf1['resolve'](_0x3d8421[_0x367870(0x195)][_0x367870(0x242)]),'model':_0x367870(0x14d)}},'source':'mcp-filesystem'})[_0x367870(0x18d)](()=>{});}}else{if(_0x4bae9b[_0x367870(0x1c2)]==='terminated'&&_0x4bae9b['errors']['length']>0x0){const _0x36cfec=_0x4bae9b[_0x367870(0x16e)][_0x367870(0x163)](_0x4b3ff2=>_0x4b3ff2[_0x367870(0x13e)])['join'](';\x20');_0x228bf2='Error:\x20'+_0x36cfec;const _0x328c97=_0x36cfec[_0x367870(0x151)]()[_0x367870(0x1d1)](_0x367870(0x201))||_0x36cfec[_0x367870(0x151)]()[_0x367870(0x1d1)](_0x367870(0x176))||_0x36cfec[_0x367870(0x151)]()[_0x367870(0x1d1)]('etimedout'),_0x3d3f8c=_0x4bae9b[_0x367870(0x1a8)]?.[_0x367870(0x206)]?.[_0x367870(0x22d)],_0x2c9284=_0x4bae9b['errors'][0x0];reportMorphError({'error_message':_0x36cfec,'error_type':_0x328c97?_0x367870(0x1fd):_0x2c9284?.[_0x367870(0x243)]?.[_0x367870(0x14e)]||_0x367870(0x238),'context':{'tool':'codebase_search','repo_path':_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'model':'morph-warp-grep-v2.1','termination_reason':_0x4bae9b[_0x367870(0x1c2)],'error_count':_0x4bae9b[_0x367870(0x16e)][_0x367870(0x1eb)],'is_timeout':_0x328c97,'timings':_0x4bae9b['timings'],'files_attempted':_0x3d3f8c?.['map'](_0x37c99e=>({'path':_0x37c99e['path'],'lines':_0x37c99e[_0x367870(0x22f)]})),'tool_calls':_0x4a5946(_0x4bae9b['messages']),'messages':_0x4bae9b['messages']?.[_0x367870(0x163)](_0x2ec35a=>({'role':_0x2ec35a[_0x367870(0x181)],'content':_0x2ec35a[_0x367870(0x1b9)],..._0x2ec35a[_0x367870(0x24e)]?{'tool_calls':_0x2ec35a[_0x367870(0x24e)]['length']}:{},..._0x2ec35a[_0x367870(0x1b7)]?{'tool_call_id':_0x2ec35a['tool_call_id']}:{}})),'request_content':{'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'repo_path':_0x3d8421[_0x367870(0x195)]['repo_path'],'repoRoot':a0_0x20fcf1['resolve'](_0x3d8421[_0x367870(0x195)][_0x367870(0x242)]),'model':_0x367870(0x14d)}},'stack_trace':_0x2c9284?.['stack']||undefined,'source':_0x367870(0x23e)})[_0x367870(0x18d)](()=>{});}else _0x228bf2=_0x367870(0x1ac);}return{'content':[{'type':_0x367870(0x177),'text':_0x228bf2}]};}catch(_0x5659ae){const _0x49c3c5=handleMorphAPIError(_0x5659ae);if(_0x49c3c5)return logger[_0x367870(0x184)](_0x367870(0x1b8),_0x367870(0x239),{'tool':_0x367870(0x1e9),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x367870(0x17c)]()-_0x32b9cc}),_0x49c3c5;const _0x2869b5=_0x5659ae instanceof Error?_0x5659ae[_0x367870(0x13e)]:String(_0x5659ae);logger[_0x367870(0x184)](_0x367870(0x1b8),'tool_call_error',{'tool':_0x367870(0x1e9),'error':_0x2869b5,'repo_path':_0x3d8421['data'][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'latency_ms':Date['now']()-_0x32b9cc});const _0xcad7e9=_0x2869b5['toLowerCase']()[_0x367870(0x1d1)](_0x367870(0x201))||_0x2869b5[_0x367870(0x151)]()[_0x367870(0x1d1)](_0x367870(0x176))||_0x2869b5['toLowerCase']()[_0x367870(0x1d1)](_0x367870(0x174))||_0x5659ae instanceof Error&&_0x5659ae['name']==='TimeoutError';return reportMorphError({'error_message':_0x2869b5,'error_type':_0xcad7e9?_0x367870(0x1fd):_0x5659ae instanceof Error?_0x5659ae['constructor']['name']:_0x367870(0x1d2),'context':{'tool':_0x367870(0x1e9),'repo_path':_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'model':_0x367870(0x14d),'is_timeout':_0xcad7e9,'exception_phase':_0x367870(0x1e5),'request_content':{'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'repo_path':_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],'repoRoot':a0_0x20fcf1[_0x367870(0x241)](_0x3d8421['data'][_0x367870(0x242)]),'model':_0x367870(0x14d)}},'stack_trace':_0x5659ae instanceof Error?_0x5659ae['stack']:undefined,'source':'mcp-filesystem'})[_0x367870(0x18d)](()=>{}),{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x14b)+_0x2869b5}],'isError':![]};}}case TOOL_NAMES['GITHUB_CODEBASE_SEARCH']:{const _0x452801=WarpGrepGitHubArgsSchema['safeParse'](_0x2c41b8);if(!_0x452801[_0x367870(0x1d5)])return{'content':[{'type':'text','text':_0x367870(0x155)+_0x452801[_0x367870(0x184)]}],'isError':!![]};const _0x31f84=_0x452801[_0x367870(0x195)][_0x367870(0x1f3)]||_0x452801['data']['owner_repo'];if(!_0x31f84)return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x20b)}],'isError':!![]};const _0x292cfd=MORPH_API_KEY;if(!_0x292cfd)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x4e8dc6=Date[_0x367870(0x17c)]();logger[_0x367870(0x1c3)](_0x367870(0x1b8),'github_search_start',{'identifier':_0x31f84,'query':_0x452801['data'][_0x367870(0x199)],'branch':_0x452801['data'][_0x367870(0x162)]});try{const _0x390dd0=new WarpGrepClient({'morphApiKey':_0x292cfd,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x50e668=await _0x390dd0[_0x367870(0x190)]({'searchTerm':_0x452801['data'][_0x367870(0x199)],'github':_0x31f84,'branch':_0x452801[_0x367870(0x195)][_0x367870(0x162)]}),_0x5d0833=Date[_0x367870(0x17c)]()-_0x4e8dc6;logMcpStderr(_0x367870(0x231)+_0x5d0833+_0x367870(0x1ad)+_0x50e668[_0x367870(0x1d5)]);const _0xdcd3=formatResult(_0x50e668);return{'content':[{'type':_0x367870(0x177),'text':_0xdcd3}]};}catch(_0x4eafbd){const _0x266454=handleMorphAPIError(_0x4eafbd);if(_0x266454)return _0x266454;const _0x7b2f22=Date[_0x367870(0x17c)]()-_0x4e8dc6,_0x12c733=_0x4eafbd instanceof Error?_0x4eafbd[_0x367870(0x13e)]:String(_0x4eafbd);return logMcpStderr(_0x367870(0x211)+_0x7b2f22+_0x367870(0x178),_0x12c733),reportMorphError({'error_message':_0x12c733,'error_type':_0x4eafbd instanceof Error?_0x4eafbd[_0x367870(0x243)]['name']:'UnknownError','context':{'tool':_0x367870(0x21d),'github_url':_0x31f84,'search_string':_0x452801['data']['search_string'],'branch':_0x452801[_0x367870(0x195)][_0x367870(0x162)]},'stack_trace':_0x4eafbd instanceof Error?_0x4eafbd[_0x367870(0x23b)]:undefined,'source':'mcp-filesystem','tool':'github_codebase_search','latency_ms':_0x7b2f22})[_0x367870(0x18d)](()=>{}),{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x1c7)+_0x12c733}],'isError':![]};}}default:throw new Error(_0x367870(0x1d4)+_0x39e5ba);}}catch(_0x18c788){const _0x3ab192=_0x18c788 instanceof Error?_0x18c788[_0x367870(0x13e)]:String(_0x18c788);return reportMorphError({'error_message':_0x3ab192,'error_type':_0x18c788 instanceof Error?_0x18c788[_0x367870(0x243)]['name']:_0x367870(0x1d2),'context':{'tool':_0x39e5ba,'arguments':_0x2c41b8?JSON[_0x367870(0x230)](_0x2c41b8)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x367870(0x262)},'stack_trace':_0x18c788 instanceof Error?_0x18c788[_0x367870(0x23b)]:undefined,'source':_0x367870(0x23e)})[_0x367870(0x18d)](()=>{}),{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x1d9)+_0x3ab192}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x3f6df9){const _0x1f8900=a0_0x50aede,_0x15d9d5=await getValidRootDirectories(_0x3f6df9);if(_0x15d9d5[_0x1f8900(0x1eb)]>0x0)allowedDirectories=[..._0x15d9d5],logMcpStderr(_0x1f8900(0x18c)+_0x15d9d5[_0x1f8900(0x1eb)]+_0x1f8900(0x24c));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x36107b=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x36107b&&(allowedDirectories=[_0x36107b],logMcpStderr(_0x1f8900(0x24f)+_0x36107b));}catch(_0x3f904a){logMcpStderr(_0x1f8900(0x254)+_0x3f904a);}}}server[a0_0x50aede(0x1a9)](RootsListChangedNotificationSchema,async()=>{const _0x2d5c5a=a0_0x50aede;try{const _0x57d765=await server[_0x2d5c5a(0x263)]();_0x57d765&&'roots'in _0x57d765&&await updateAllowedDirectoriesFromRoots(_0x57d765[_0x2d5c5a(0x182)]);}catch(_0x476442){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x476442 instanceof Error?_0x476442[_0x2d5c5a(0x13e)]:String(_0x476442));}}),server[a0_0x50aede(0x209)]=async()=>{const _0x26d65e=a0_0x50aede,_0x594014=server['getClientCapabilities']();if(_0x594014?.['roots'])try{const _0x5b73e2=await server['listRoots']();_0x5b73e2&&_0x26d65e(0x182)in _0x5b73e2?await updateAllowedDirectoriesFromRoots(_0x5b73e2[_0x26d65e(0x182)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x10eac3){logMcpStderr(_0x26d65e(0x17b),_0x10eac3 instanceof Error?_0x10eac3[_0x26d65e(0x13e)]:String(_0x10eac3));}else{if(allowedDirectories[_0x26d65e(0x1eb)]>0x0)logMcpStderr(_0x26d65e(0x25c),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x26d65e(0x1ff));else throw new Error(_0x26d65e(0x164));}}};async function runServer(){const _0x51224e=a0_0x50aede,_0x57b860=new StdioServerTransport();await server['connect'](_0x57b860),logMcpStderr(_0x51224e(0x25e)),allowedDirectories['length']===0x0&&logMcpStderr(_0x51224e(0x216));}runServer()[a0_0x50aede(0x18d)](_0x29f384=>{logMcpStderr('Fatal\x20error\x20running\x20server:',_0x29f384),process['exit'](0x1);});
|
|
2
|
+
const a0_0x240656=a0_0x1a82;(function(_0x43a044,_0x3fc623){const _0x530a01=a0_0x1a82,_0x54915c=_0x43a044();while(!![]){try{const _0x3019d0=parseInt(_0x530a01(0x232))/0x1+parseInt(_0x530a01(0x19e))/0x2+-parseInt(_0x530a01(0x196))/0x3+-parseInt(_0x530a01(0x249))/0x4*(-parseInt(_0x530a01(0x1a3))/0x5)+-parseInt(_0x530a01(0x24c))/0x6*(-parseInt(_0x530a01(0x299))/0x7)+parseInt(_0x530a01(0x1f6))/0x8+-parseInt(_0x530a01(0x1c6))/0x9*(parseInt(_0x530a01(0x25c))/0xa);if(_0x3019d0===_0x3fc623)break;else _0x54915c['push'](_0x54915c['shift']());}catch(_0x26494d){_0x54915c['push'](_0x54915c['shift']());}}}(a0_0x4719,0x19445));import{Server}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x5207e6 from'fs/promises';import a0_0x4c88d7 from'path';import a0_0x1ee4d4 from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{logger}from'./logger.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0x4832c4 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x4a222b){const _0x3e8997=a0_0x1a82,_0x40ea2e=_0x4a222b[_0x3e8997(0x296)](a0_0x4c88d7['sep'])['filter'](Boolean);if(_0x40ea2e[_0x3e8997(0x19a)]<0x2)return null;for(let _0x539993=Math[_0x3e8997(0x1bd)](_0x40ea2e['length']/0x2);_0x539993>=0x1;_0x539993--){for(let _0x50f340=0x0;_0x50f340<=_0x40ea2e[_0x3e8997(0x19a)]-0x2*_0x539993;_0x50f340++){const _0xbb88d5=_0x40ea2e[_0x3e8997(0x199)](_0x50f340,_0x50f340+_0x539993),_0x14d241=_0x40ea2e['slice'](_0x50f340+_0x539993,_0x50f340+0x2*_0x539993);if(_0xbb88d5[_0x3e8997(0x23f)]((_0x564552,_0x4fe823)=>_0x564552===_0x14d241[_0x4fe823])){const _0x472d4b=[..._0x40ea2e[_0x3e8997(0x199)](0x0,_0x50f340),..._0x40ea2e[_0x3e8997(0x199)](_0x50f340+_0x539993)];return a0_0x4c88d7[_0x3e8997(0x27c)]+_0x472d4b[_0x3e8997(0x20e)](a0_0x4c88d7['sep']);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x25929f=a0_0x1a82;try{const _0x5e2d13=require(_0x25929f(0x263));return _0x5e2d13['version']??_0x25929f(0x1af);}catch(_0x4406aa){return logMcpStderr(_0x25929f(0x29e),_0x4406aa),_0x25929f(0x1af);}}function printHelp(){const _0x19ed23=a0_0x1a82;console[_0x19ed23(0x292)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x19ed23(0x292)](_0x19ed23(0x293)),console[_0x19ed23(0x292)]('\x0aOptions:'),console[_0x19ed23(0x292)](_0x19ed23(0x1e8)),console['log'](_0x19ed23(0x298)),console[_0x19ed23(0x292)](_0x19ed23(0x262)),console[_0x19ed23(0x292)](_0x19ed23(0x1ab)),console[_0x19ed23(0x292)](_0x19ed23(0x1bf)),console['log'](_0x19ed23(0x1b7));}const cliArgs=process[a0_0x240656(0x1a9)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x240656(0x18b),'-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs[a0_0x240656(0x1c3)](_0x247935=>VERSION_FLAGS['has'](_0x247935))&&(console[a0_0x240656(0x292)](a0_0x240656(0x193)+getPackageVersion()),process['exit'](0x0));cliArgs[a0_0x240656(0x1c3)](_0x564fed=>HELP_FLAGS['has'](_0x564fed))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x2f90d0){const _0x1cf539=a0_0x240656;for(let _0x5953a3=0x0;_0x5953a3<cliArgs[_0x1cf539(0x19a)];_0x5953a3++){const _0xf0309f=cliArgs[_0x5953a3];if(_0xf0309f[_0x1cf539(0x1c4)]('--'+_0x2f90d0+'='))return _0xf0309f[_0x1cf539(0x199)](('--'+_0x2f90d0+'=')[_0x1cf539(0x19a)]);if(_0xf0309f==='--'+_0x2f90d0&&_0x5953a3+0x1<cliArgs[_0x1cf539(0x19a)])return cliArgs[_0x5953a3+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x240656(0x19a)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x240656(0x204)](arg)||HELP_FLAGS[a0_0x240656(0x204)](arg))continue;if(arg['startsWith'](a0_0x240656(0x267)))continue;if(arg===a0_0x240656(0x22b)){i++;continue;}args[a0_0x240656(0x1a2)](arg);}const WORKSPACE_ROOT=process['env'][a0_0x240656(0x184)]||process[a0_0x240656(0x190)]['PWD']||process[a0_0x240656(0x197)](),ENABLE_WORKSPACE_MODE=process[a0_0x240656(0x190)][a0_0x240656(0x1d7)]!==a0_0x240656(0x28f),MORPH_API_KEY=getCliArg('api-key')??process[a0_0x240656(0x190)][a0_0x240656(0x1a1)],MORPH_API_URL=process[a0_0x240656(0x190)]['MORPH_API_URL'],MORPH_LARGE_APPLY=process[a0_0x240656(0x190)][a0_0x240656(0x244)]!==a0_0x240656(0x28f),MORPH_WARP_GREP_TIMEOUT=process[a0_0x240656(0x190)][a0_0x240656(0x24b)]?parseInt(process[a0_0x240656(0x190)]['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x240656(0x190)][a0_0x240656(0x1b1)]?new Set(process[a0_0x240656(0x190)]['DISABLED_TOOLS']['split'](',')[a0_0x240656(0x185)](_0x5b25cd=>_0x5b25cd[a0_0x240656(0x17f)]())['filter'](_0x31ad5f=>_0x31ad5f[a0_0x240656(0x19a)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x240656(0x269)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x240656(0x29c)](a0_0x240656(0x243)+tool+a0_0x240656(0x17e)+[...KNOWN_TOOL_NAMES][a0_0x240656(0x20e)](',\x20'));}console[a0_0x240656(0x29c)](a0_0x240656(0x210)+[...DISABLED_TOOLS][a0_0x240656(0x20e)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x240656(0x219))&&!MORPH_API_KEY[a0_0x240656(0x1c4)](a0_0x240656(0x19d))&&logMcpStderr(a0_0x240656(0x29a));async function reportMorphError(_0x144b41){const _0x2e95d2=a0_0x240656;try{await a0_0x4832c4['post'](_0x2e95d2(0x1ac),{..._0x144b41,'timestamp':new Date()[_0x2e95d2(0x1db)](),'source':_0x144b41[_0x2e95d2(0x1e0)]||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x144b41[_0x2e95d2(0x257)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x2e95d2(0x1c1),'Authorization':_0x2e95d2(0x226)+MORPH_API_KEY}});}catch{}}function a0_0x1a82(_0x42a8f6,_0x233d48){_0x42a8f6=_0x42a8f6-0x17d;const _0x4719ac=a0_0x4719();let _0x1a8236=_0x4719ac[_0x42a8f6];return _0x1a8236;}function extractStatusCode(_0x3820d7,_0x4c92f5){const _0x3ee3ad=a0_0x240656;if(_0x3820d7&&typeof _0x3820d7===_0x3ee3ad(0x286)&&'status'in _0x3820d7)return _0x3820d7[_0x3ee3ad(0x18c)];if(_0x3820d7&&typeof _0x3820d7==='object'&&_0x3ee3ad(0x291)in _0x3820d7)return _0x3820d7[_0x3ee3ad(0x291)]?.[_0x3ee3ad(0x18c)];const _0x2630e8=_0x4c92f5[_0x3ee3ad(0x2a4)](/\b(401|429)\b/);return _0x2630e8?parseInt(_0x2630e8[0x1],0xa):null;}function handleMorphAPIError(_0x5d8342){const _0x3f1a55=a0_0x240656,_0x489dbc=_0x5d8342 instanceof Error?_0x5d8342[_0x3f1a55(0x282)]:String(_0x5d8342),_0x1b92d8=extractStatusCode(_0x5d8342,_0x489dbc);switch(_0x1b92d8){case 0x191:return{'content':[{'type':_0x3f1a55(0x23e),'text':'Authentication\x20failed:\x20Your\x20Morph\x20API\x20key\x20is\x20invalid\x20or\x20has\x20been\x20revoked.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key,\x20then\x20update\x20your\x20MCP\x20configuration.'}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x3f1a55(0x23e),'text':_0x3f1a55(0x295)}],'isError':!![]};default:return null;}}args[a0_0x240656(0x19a)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x240656(0x29d)),logMcpStderr(a0_0x240656(0x283)),logMcpStderr(a0_0x240656(0x2a0)),logMcpStderr(a0_0x240656(0x297)),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr(a0_0x240656(0x1a8)));function normalizePath(_0x31a301){const _0x25a908=a0_0x240656;return a0_0x4c88d7[_0x25a908(0x273)](_0x31a301);}function expandHome(_0x346f65){const _0x4cbc47=a0_0x240656;if(_0x346f65[_0x4cbc47(0x1c4)]('~/')||_0x346f65==='~')return a0_0x4c88d7[_0x4cbc47(0x20e)](a0_0x1ee4d4['homedir'](),_0x346f65[_0x4cbc47(0x199)](0x1));return _0x346f65;}let allowedDirectories=await Promise[a0_0x240656(0x1f8)](args['map'](async _0x31d402=>{const _0x2c9171=a0_0x240656,_0x5091d6=expandHome(_0x31d402),_0x416676=a0_0x4c88d7[_0x2c9171(0x24a)](_0x5091d6);try{const _0x2edc74=await a0_0x5207e6[_0x2c9171(0x26c)](_0x416676);return normalizePath(_0x2edc74);}catch(_0x35da41){return normalizePath(_0x416676);}}));function a0_0x4719(){const _0x3bd627=['now','tool_call_id','description','\x22>\x0a','1457152PyXnbT','assistant','all','changes','GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','github_search_start','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','repo_path','go.mod','compaction_failed','stringify','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','Invalid\x20arguments:\x20','has','Error\x20accessing\x20directory\x20','Preview\x20changes\x20without\x20applying\x20them.','linesRemoved','new_string','catch','etimedout','metadata','parse','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','join','\x20as\x20allowed\x20directory','Disabled\x20tools:\x20','ReadError','Failed\x20to\x20read\x20file:\x20','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','-\x20Read\x20file\x20`','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','runWarpGrep_call','warn','errors','sk-','content','list_directory\x20','Error:\x20','The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos','\x20-\x20','owner_repo','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','search_string','github_url','array','composer.json','Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.','Bearer\x20','Specific\x20commit\x20hash\x20to\x20search','includes','Unknown\x20error','-\x20Preserve\x20exact\x20indentation\x0a','--api-key','read\x20','\x0a</file>','tool_call_error','number','Repository\x20identifier','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','60682WMICZA','readFile','path_validation_start','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','command','role','grep_search','.\x20Changes:\x20','lines','boolean',',\x20removed\x20','code','text','every','FileNotFound','package.json','list_directory','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','MORPH_LARGE_APPLY','instructions','Relevant\x20context\x20found:','code_edit','Workspace\x20mode\x20enabled:\x20Using\x20','18788nqsmuH','resolve','MORPH_WARP_GREP_TIMEOUT','18rRmwVp','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','path_validation_failed','path_validation_resolved','file_read_failed','setRequestHandler','safeParse','Parent\x20directory\x20does\x20not\x20exist:\x20','RipgrepNotAvailable','Here\x20is\x20the\x20content\x20of\x20files:\x0a','substring','context','connect','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','branch','API\x20error\x20(auth/rate-limit)','30JIxvQG','FileReadError','timings','Warning:\x20Workspace\x20fallback\x20failed:\x20','Use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code\x20blocks.\x20Include\x20just\x20enough\x20surrounding\x20context\x20to\x20locate\x20each\x20edit\x20precisely.\x0a\x0a','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','../package.json','searchGitHub','provider_created','describe','--api-key=','filter','size','ms:','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','realpath','Max\x20results\x20to\x20return','[github_codebase_search]\x20Failed\x20in\x20','path','Unknown\x20tool:\x20','[could\x20not\x20read\x20file:\x20','A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20','normalize','roots','messages','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','\x0a...\x20(truncated,\x20total:\x20','tool_calls','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','tool_call_received','`\x20in\x20`','sep','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','.\x20Path:\x20','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','enum','message','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','dryRun','MCP','object','files','morph-v3-fast','constructor','default','grep\x20\x27','toLowerCase','RipgrepError','.git','false','isArray','response','log','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','Cargo.toml','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','split','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','271285AKedCS','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','github_codebase_search','error','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','timeout','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','\x27\x20in\x20`','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','completed','match','edit_file','added\x20','timed\x20out','completionId','user','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','edit','ENOENT','PathError','SubToolError','\x20valid\x20directories','\x22.\x20Known\x20tools:\x20','trim','debug','ms.\x20Success:\x20','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','access','WORKSPACE_ROOT','map','SymlinkError','ToolException','BinaryFile','LocalRipgrepProvider','function','--version','status','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.','oninitialized','env','linesModified','finish','@morphllm/morphmcp\x20','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','inputSchema','230178uDlQqK','cwd','completed_with_file_errors','slice','length','mcp-filesystem','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','morph-','155738mrQHtn','\x20disabled\x20via\x20DISABLED_TOOLS','data','MORPH_API_KEY','push','80PFUbXa','basename','Morph\x20FastApply\x20failed\x20without\x20error\x20message','string','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','argv','grep','\x0aExamples:','https://morphllm.com/api/error-report','TimeoutError','-\x20Listed\x20directory\x20`','unknown','CODEBASE_SEARCH','DISABLED_TOOLS','stack','target_file','Tool\x20','Fatal\x20error\x20running\x20server:','terminated','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','read','Failed\x20to\x20request\x20roots\x20from\x20client:','tool','tool_call_complete','glob\x20\x27','floor','UnknownError','\x20\x20morph-mcp','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','application/json','Fallback:\x20Using\x20workspace\x20root\x20','some','startsWith','requiresApiKey','995679vOhSjR','Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.','params','Example\x20format:\x0a','dirname','morph-mcp','node_modules','EDIT_FILE','exit','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','glob','isDirectory',',\x20modified\x20','<file\x20path=\x22','file_read_complete','success','indexOf','ENABLE_WORKSPACE_MODE','warp_grep_complete','arguments','optional','toISOString','payload','Parameters:\x0a','Tool\x20\x22','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','source','codebase_search','unknown\x20error','pattern','search_type','Morph\x20Edit\x20','linesAdded','morph-warp-grep-v2.1','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','GITHUB_CODEBASE_SEARCH','\x20(new\x20file)','instruction','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','name','-\x20Glob\x20search\x20`','listRoots','terminationReason','File\x20read\x20error:'];a0_0x4719=function(){return _0x3bd627;};return a0_0x4719();}if(ENABLE_WORKSPACE_MODE&&args[a0_0x240656(0x19a)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr(a0_0x240656(0x248)+workspaceDir+a0_0x240656(0x20f)));}catch(a0_0x4d6634){logMcpStderr(a0_0x240656(0x279)+a0_0x4d6634);}async function detectWorkspaceRoot(_0x58c676){const _0x255f3d=a0_0x240656;let _0x55cda6=a0_0x4c88d7[_0x255f3d(0x24a)](_0x58c676);const _0x383395=[_0x255f3d(0x28e),'.vscode',_0x255f3d(0x241),_0x255f3d(0x294),'pyproject.toml',_0x255f3d(0x1fe),'.cursor','tsconfig.json',_0x255f3d(0x224)];while(_0x55cda6!==a0_0x4c88d7['dirname'](_0x55cda6)){for(const _0x521827 of _0x383395){const _0x1823aa=a0_0x4c88d7[_0x255f3d(0x20e)](_0x55cda6,_0x521827);try{return await a0_0x5207e6[_0x255f3d(0x183)](_0x1823aa),normalizePath(_0x55cda6);}catch{}}_0x55cda6=a0_0x4c88d7[_0x255f3d(0x1ca)](_0x55cda6);}return normalizePath(_0x58c676);}await Promise[a0_0x240656(0x1f8)](args[a0_0x240656(0x185)](async _0x434d89=>{const _0x54ba0a=a0_0x240656;try{const _0x30aeec=await a0_0x5207e6['stat'](expandHome(_0x434d89));!_0x30aeec[_0x54ba0a(0x1d1)]()&&(logMcpStderr(_0x54ba0a(0x21c)+_0x434d89+'\x20is\x20not\x20a\x20directory'),process[_0x54ba0a(0x1ce)](0x1));}catch(_0x537a6c){logMcpStderr(_0x54ba0a(0x205)+_0x434d89+':',_0x537a6c),process['exit'](0x1);}}));async function validatePath(_0x4fb9ea){const _0x35f60f=a0_0x240656,_0x47c244=expandHome(_0x4fb9ea),_0x550569=a0_0x4c88d7['resolve'](_0x47c244);logger[_0x35f60f(0x180)](_0x35f60f(0x285),_0x35f60f(0x234),{'raw_path':_0x4fb9ea,'absolute':_0x550569});try{const _0x3a4b76=await a0_0x5207e6[_0x35f60f(0x26c)](_0x550569);return logger[_0x35f60f(0x180)](_0x35f60f(0x285),'path_validation_resolved',{'resolved':_0x3a4b76,'symlink':_0x3a4b76!==_0x550569}),_0x3a4b76;}catch(_0x1e7816){if(_0x1e7816[_0x35f60f(0x23d)]===_0x35f60f(0x2ac)){const _0x2b2205=a0_0x4c88d7[_0x35f60f(0x1ca)](_0x550569);try{const _0x4940a6=await a0_0x5207e6[_0x35f60f(0x26c)](_0x2b2205),_0x21ba7b=a0_0x4c88d7[_0x35f60f(0x20e)](_0x4940a6,a0_0x4c88d7[_0x35f60f(0x1a4)](_0x550569));return logger[_0x35f60f(0x180)](_0x35f60f(0x285),_0x35f60f(0x24f),{'resolved':_0x21ba7b,'new_file':!![]}),_0x21ba7b;}catch{logger['error']('MCP',_0x35f60f(0x24e),{'raw_path':_0x4fb9ea,'error':_0x35f60f(0x253)+_0x2b2205});throw new Error(_0x35f60f(0x253)+_0x2b2205);}}logger[_0x35f60f(0x29c)]('MCP',_0x35f60f(0x24e),{'raw_path':_0x4fb9ea,'error':_0x1e7816[_0x35f60f(0x282)]});throw _0x1e7816;}}const MorphEditFileArgsSchema=z[a0_0x240656(0x286)]({'path':z[a0_0x240656(0x1a6)](),'code_edit':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x266)](a0_0x240656(0x202)),'instruction':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x266)](a0_0x240656(0x194)),'dryRun':z[a0_0x240656(0x23b)]()[a0_0x240656(0x28a)](![])['describe'](a0_0x240656(0x206))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x240656(0x225),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x240656(0x1a6)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x266)](a0_0x240656(0x21d)),'search_type':z[a0_0x240656(0x281)](['default',a0_0x240656(0x1cc)])[a0_0x240656(0x1da)]()['describe'](a0_0x240656(0x27d))}),WarpGrepGitHubArgsSchema=z[a0_0x240656(0x286)]({'search_string':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x266)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x1da)]()['describe'](a0_0x240656(0x1fa)),'owner_repo':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x1da)]()[a0_0x240656(0x266)](a0_0x240656(0x280)),'branch':z['string']()[a0_0x240656(0x1da)]()[a0_0x240656(0x266)](a0_0x240656(0x27e))}),CodebaseSearchArgsSchema=z[a0_0x240656(0x286)]({'query':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x266)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x266)](a0_0x240656(0x230)),'branch':z['string']()['optional']()[a0_0x240656(0x266)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z['string']()['optional']()[a0_0x240656(0x266)](a0_0x240656(0x227)),'targetDirectories':z[a0_0x240656(0x223)](z[a0_0x240656(0x1a6)]())[a0_0x240656(0x28a)]([])[a0_0x240656(0x266)](a0_0x240656(0x259)),'limit':z[a0_0x240656(0x22f)]()[a0_0x240656(0x1da)]()[a0_0x240656(0x28a)](0xa)['describe'](a0_0x240656(0x26d))}),server=new Server({'name':a0_0x240656(0x1cb),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x240656(0x251)](ListToolsRequestSchema,async()=>{const _0x596c63=a0_0x240656,_0x5c3978=[{'name':TOOL_NAMES['EDIT_FILE'],'description':_0x596c63(0x261)+_0x596c63(0x1dd)+_0x596c63(0x1df)+_0x596c63(0x235)+_0x596c63(0x2a2)+_0x596c63(0x260)+_0x596c63(0x1c9)+_0x596c63(0x1a7)+'Rules:\x0a'+_0x596c63(0x18d)+_0x596c63(0x22a)+'-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a'+_0x596c63(0x213),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x596c63(0x1b0)],'description':_0x596c63(0x272)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+'Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20'+_0x596c63(0x26b)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x3fc4ca=_0x5c3978[_0x596c63(0x268)](_0x38ae22=>{const _0x499db5=_0x596c63;if(DISABLED_TOOLS[_0x499db5(0x204)](_0x38ae22[_0x499db5(0x1ed)]))return console[_0x499db5(0x29c)](_0x499db5(0x1b4)+_0x38ae22[_0x499db5(0x1ed)]+_0x499db5(0x19f)),![];if(_0x499db5(0x1c5)in _0x38ae22&&_0x38ae22[_0x499db5(0x1c5)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x38ae22[_0x499db5(0x1ed)]+_0x499db5(0x1cf)),![];return!![];});return{'tools':_0x3fc4ca['map'](_0x2a7b33=>({'name':_0x2a7b33[_0x596c63(0x1ed)],'description':_0x2a7b33[_0x596c63(0x1f4)],'inputSchema':_0x2a7b33[_0x596c63(0x195)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x26e4a5=>{const _0x426f0e=a0_0x240656,{name:_0x5e3c72,arguments:_0x4aeb44}=_0x26e4a5[_0x426f0e(0x1c8)],_0x19a68a=Date[_0x426f0e(0x1f2)]();logger[_0x426f0e(0x180)]('MCP',_0x426f0e(0x27a),{'tool':_0x5e3c72,'args':_0x5e3c72==='edit_file'?{'path':_0x4aeb44?.[_0x426f0e(0x26f)],'instruction':_0x4aeb44?.['instruction']||_0x4aeb44?.[_0x426f0e(0x245)],'dryRun':_0x4aeb44?.[_0x426f0e(0x284)]}:_0x4aeb44});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x426f0e(0x23e),'text':_0x426f0e(0x20d)}],'isError':!![]};if(!MORPH_API_KEY['startsWith']('sk-')&&!MORPH_API_KEY[_0x426f0e(0x1c4)](_0x426f0e(0x19d)))return{'content':[{'type':_0x426f0e(0x23e),'text':_0x426f0e(0x18e)}],'isError':!![]};if(DISABLED_TOOLS['has'](_0x5e3c72))return{'content':[{'type':_0x426f0e(0x23e),'text':_0x426f0e(0x1de)+_0x5e3c72+_0x426f0e(0x1c0)}],'isError':![]};switch(_0x5e3c72){case TOOL_NAMES[_0x426f0e(0x1cd)]:{let _0x347b27=_0x4aeb44;if(_0x347b27&&typeof _0x347b27==='object'){if(!(_0x426f0e(0x26f)in _0x347b27)){const _0x2be5e3=_0x347b27[_0x426f0e(0x1b3)]??_0x347b27['filePath']??_0x347b27['target_filepath']??_0x347b27['file_path']??_0x347b27['file'];if(_0x2be5e3)_0x347b27={..._0x347b27,'path':_0x2be5e3};}_0x426f0e(0x245)in _0x347b27&&!(_0x426f0e(0x1eb)in _0x347b27)&&(_0x347b27={..._0x347b27,'instruction':_0x347b27[_0x426f0e(0x245)]});if(!(_0x426f0e(0x247)in _0x347b27)){const _0x232689=_0x347b27[_0x426f0e(0x23d)]??_0x347b27[_0x426f0e(0x208)]??_0x347b27['content']??_0x347b27[_0x426f0e(0x2ab)];if(_0x232689)_0x347b27={..._0x347b27,'code_edit':_0x232689};}}const _0x29e50c=MorphEditFileArgsSchema[_0x426f0e(0x252)](_0x347b27);if(!_0x29e50c[_0x426f0e(0x1d5)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x29e50c[_0x426f0e(0x29c)]);const _0x44db33=await validatePath(_0x29e50c['data'][_0x426f0e(0x26f)]);let _0x2a806c=null,_0x4721f4=!![],_0x552c58=null;try{_0x2a806c=await a0_0x5207e6[_0x426f0e(0x233)](_0x44db33,'utf-8'),logger['debug'](_0x426f0e(0x285),_0x426f0e(0x1d4),{'path':_0x44db33,'size_bytes':_0x2a806c[_0x426f0e(0x19a)]});}catch(_0x5caa45){const _0x23f4dd=_0x5caa45[_0x426f0e(0x23d)];_0x23f4dd===_0x426f0e(0x2ac)?(_0x4721f4=![],_0x2a806c='',logger['debug'](_0x426f0e(0x285),'file_read_complete',{'path':_0x44db33,'exists':![]})):(_0x552c58=_0x426f0e(0x212)+(_0x23f4dd||_0x426f0e(0x1af))+_0x426f0e(0x21e)+(_0x5caa45 instanceof Error?_0x5caa45[_0x426f0e(0x282)]:String(_0x5caa45)),logger[_0x426f0e(0x29c)](_0x426f0e(0x285),_0x426f0e(0x250),{'path':_0x44db33,'error':_0x552c58}),logMcpStderr('Warning:\x20'+_0x552c58));}let _0x57c52a;try{const _0x467539=MORPH_API_KEY;if(!_0x467539)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x434b46=a0_0x4c88d7[_0x426f0e(0x1ca)](_0x44db33),_0xba21c=a0_0x4c88d7[_0x426f0e(0x1a4)](_0x44db33);logger[_0x426f0e(0x180)](_0x426f0e(0x285),'api_request_start',{'model':_0x426f0e(0x288),'path':_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x26f)],'instruction_len':_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x1eb)]['length'],'code_edit_len':_0x29e50c['data'][_0x426f0e(0x247)][_0x426f0e(0x19a)],'original_code_len':_0x2a806c?.['length']??0x0,'dry_run':_0x29e50c[_0x426f0e(0x1a0)]['dryRun']});const _0x67ddb8=Date[_0x426f0e(0x1f2)](),_0x23f2bd=await executeEditFile({'target_filepath':_0xba21c,'code_edit':_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x247)],'instruction':_0x29e50c['data'][_0x426f0e(0x1eb)]},{'morphApiKey':_0x467539,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x434b46,'autoWrite':!_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x284)],'generateUdiff':![],'debug':![]}),_0x221939=Date[_0x426f0e(0x1f2)]()-_0x67ddb8;_0x57c52a=_0x23f2bd[_0x426f0e(0x2a8)];if(!_0x23f2bd['success'])throw new Error(_0x23f2bd[_0x426f0e(0x29c)]||_0x426f0e(0x1a5));const _0x4fa55d=_0x23f2bd[_0x426f0e(0x1f9)],_0x1a42e0=_0x426f0e(0x2a6)+_0x4fa55d[_0x426f0e(0x1e6)]+_0x426f0e(0x23c)+_0x4fa55d[_0x426f0e(0x207)]+_0x426f0e(0x1d2)+_0x4fa55d[_0x426f0e(0x191)];logger[_0x426f0e(0x180)](_0x426f0e(0x285),_0x426f0e(0x1bb),{'tool':'edit_file','success':!![],'latency_ms':Date[_0x426f0e(0x1f2)]()-_0x19a68a,'edit_latency_ms':_0x221939,'changes':{'added':_0x4fa55d[_0x426f0e(0x1e6)],'removed':_0x4fa55d[_0x426f0e(0x207)],'modified':_0x4fa55d[_0x426f0e(0x191)]},'completion_id':_0x57c52a});if(_0x29e50c[_0x426f0e(0x1a0)]['dryRun'])return{'content':[{'type':'text','text':'Morph\x20Edit\x20Preview'+(_0x4721f4?'':_0x426f0e(0x1ea))+':\x20'+_0x29e50c['data'][_0x426f0e(0x1eb)]+_0x426f0e(0x239)+_0x1a42e0+_0x426f0e(0x27f)+_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x26f)]+'.'}]};return{'content':[{'type':'text','text':_0x426f0e(0x1e5)+(_0x4721f4?'Applied':'Created\x20File')+':\x20'+_0x29e50c[_0x426f0e(0x1a0)]['instruction']+_0x426f0e(0x239)+_0x1a42e0+_0x426f0e(0x27f)+_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x26f)]+'.'}]};}catch(_0x1a6928){const _0x3cd8a9=handleMorphAPIError(_0x1a6928);if(_0x3cd8a9)return logger[_0x426f0e(0x29c)]('MCP',_0x426f0e(0x22e),{'tool':_0x426f0e(0x2a5),'error':_0x426f0e(0x25b),'latency_ms':Date[_0x426f0e(0x1f2)]()-_0x19a68a}),_0x3cd8a9;const _0x58c548=_0x1a6928 instanceof Error?_0x1a6928['message']:String(_0x1a6928);return logger[_0x426f0e(0x29c)](_0x426f0e(0x285),_0x426f0e(0x22e),{'tool':_0x426f0e(0x2a5),'error':_0x58c548,'path':_0x29e50c[_0x426f0e(0x1a0)]['path'],'validated_path':_0x44db33,'latency_ms':Date[_0x426f0e(0x1f2)]()-_0x19a68a,'stack':_0x1a6928 instanceof Error?_0x1a6928[_0x426f0e(0x1b2)]:undefined}),reportMorphError({'error_message':_0x58c548,'error_type':_0x1a6928 instanceof Error?_0x1a6928[_0x426f0e(0x289)][_0x426f0e(0x1ed)]:_0x426f0e(0x1be),'context':{'tool':_0x426f0e(0x2a5),'completion_id':_0x57c52a,'file_path':_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x26f)],'validated_path':_0x44db33,'instruction':_0x29e50c[_0x426f0e(0x1a0)]['instruction'],'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x426f0e(0x288),'dry_run':_0x29e50c['data']['dryRun'],'file_exists':_0x4721f4,'file_read_error':_0x552c58,'file_readable':_0x2a806c!==null,'request_content':{'path':_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x26f)],'code_edit':_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x247)],'instruction':_0x29e50c['data'][_0x426f0e(0x1eb)],'original_code':_0x2a806c!==null?_0x2a806c[_0x426f0e(0x19a)]>0xc350?_0x2a806c[_0x426f0e(0x256)](0x0,0xc350)+_0x426f0e(0x277)+_0x2a806c[_0x426f0e(0x19a)]+'\x20chars)':_0x2a806c:_0x426f0e(0x271)+(_0x552c58||_0x426f0e(0x1e2))+']','original_code_length':_0x2a806c?.['length']??0x0,'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x426f0e(0x288),'dry_run':_0x29e50c['data'][_0x426f0e(0x284)]}},'stack_trace':_0x1a6928 instanceof Error?_0x1a6928[_0x426f0e(0x1b2)]:undefined,'source':_0x426f0e(0x19b)})[_0x426f0e(0x209)](()=>{}),{'content':[{'type':_0x426f0e(0x23e),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x58c548}],'isError':!![]};}}case TOOL_NAMES['CODEBASE_SEARCH']:{const _0x16d1c7=WarpGrepArgsSchema[_0x426f0e(0x252)](_0x4aeb44);if(!_0x16d1c7['success'])return{'content':[{'type':'text','text':_0x426f0e(0x203)+_0x16d1c7[_0x426f0e(0x29c)]}],'isError':!![]};const _0x2f695c=_0x2ca39e=>{const _0x2e5e51=_0x426f0e,_0x4af8cd=[];for(const _0x3b0a94 of _0x2ca39e||[]){if(_0x3b0a94[_0x2e5e51(0x237)]===_0x2e5e51(0x1f7)&&Array['isArray'](_0x3b0a94[_0x2e5e51(0x278)]))for(const _0x3098a2 of _0x3b0a94[_0x2e5e51(0x278)]){try{const _0x3222af=_0x3098a2[_0x2e5e51(0x18a)]?.[_0x2e5e51(0x1ed)],_0x170498=JSON['parse'](_0x3098a2['function']?.[_0x2e5e51(0x1d9)]||'{}');if(_0x3222af==='grep_search')_0x4af8cd[_0x2e5e51(0x1a2)](_0x2e5e51(0x28b)+_0x170498['pattern']+'\x27\x20'+(_0x170498[_0x2e5e51(0x26f)]||'.'));else{if(_0x3222af==='read')_0x4af8cd[_0x2e5e51(0x1a2)](_0x2e5e51(0x22c)+_0x170498[_0x2e5e51(0x26f)]);else{if(_0x3222af===_0x2e5e51(0x242))_0x4af8cd[_0x2e5e51(0x1a2)](_0x2e5e51(0x21b)+(_0x170498['command']||'.'));else{if(_0x3222af===_0x2e5e51(0x1d0))_0x4af8cd[_0x2e5e51(0x1a2)](_0x2e5e51(0x1bc)+_0x170498['pattern']+'\x27\x20'+(_0x170498['path']||'.'));else _0x3222af===_0x2e5e51(0x192)&&_0x4af8cd[_0x2e5e51(0x1a2)](_0x2e5e51(0x192));}}}}catch{}}}return _0x4af8cd;},_0x5a292d=_0x4c581a=>{const _0x510d34=_0x426f0e,_0x3df306=[];if(!_0x4c581a||!Array[_0x510d34(0x290)](_0x4c581a))return _0x3df306;const _0x3db5d3=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x510d34(0x240),'tool':_0x510d34(0x1b8)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x510d34(0x2ad),'tool':_0x510d34(0x1b8)},{'pattern':/\[READ ERROR\]/,'error_type':_0x510d34(0x211),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x510d34(0x188),'tool':_0x510d34(0x1b8)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x510d34(0x28d),'tool':_0x510d34(0x1aa)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x510d34(0x254),'tool':_0x510d34(0x1aa)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x510d34(0x188),'tool':_0x510d34(0x1b8)},{'pattern':/\[SYMLINK\]/,'error_type':_0x510d34(0x186),'tool':_0x510d34(0x1b8)},{'pattern':/not a text file/,'error_type':'BinaryFile','tool':'read'},{'pattern':/symbolic link/,'error_type':_0x510d34(0x186),'tool':_0x510d34(0x1b8)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x510d34(0x1b8)},{'pattern':/status="error"/,'error_type':_0x510d34(0x187),'tool':'unknown'}];let _0x1bc69a=0x0;for(const _0x4e136f of _0x4c581a){_0x4e136f[_0x510d34(0x237)]===_0x510d34(0x1f7)&&Array[_0x510d34(0x290)](_0x4e136f['tool_calls'])&&_0x1bc69a++;const _0x3084fa=_0x4e136f[_0x510d34(0x21a)];if((_0x4e136f[_0x510d34(0x237)]===_0x510d34(0x1ba)||_0x4e136f[_0x510d34(0x237)]===_0x510d34(0x2a9))&&_0x3084fa&&typeof _0x3084fa===_0x510d34(0x1a6))for(const {pattern:_0x460bc5,error_type:_0x10b821,tool:_0x5285c6}of _0x3db5d3){const _0x1e1117=_0x3084fa[_0x510d34(0x2a4)](new RegExp(_0x460bc5['source'],'g'));if(_0x1e1117)for(const _0x45e74c of _0x1e1117){const _0x591753=_0x3084fa[_0x510d34(0x1d6)](_0x45e74c),_0x410df5=_0x3084fa[_0x510d34(0x256)](_0x591753,Math['min'](_0x591753+0xc8,_0x3084fa[_0x510d34(0x19a)]));_0x3df306['push']({'tool':_0x5285c6,'error_type':_0x10b821,'error_message':_0x410df5[_0x510d34(0x296)]('\x0a')[0x0],'turn':_0x1bc69a});}}}return _0x3df306;};try{const _0xf48624=a0_0x4c88d7[_0x426f0e(0x24a)](_0x16d1c7[_0x426f0e(0x1a0)]['repo_path']),_0x2357ff=_0x16d1c7['data'][_0x426f0e(0x1e4)],_0xa86b20=_0x2357ff===_0x426f0e(0x1cc)?{'allowNames':[_0x426f0e(0x1cc)]}:undefined,_0x4892d1=new LocalRipgrepProvider(_0xf48624,undefined,_0xa86b20);logger['debug'](_0x426f0e(0x285),_0x426f0e(0x265),{'type':_0x426f0e(0x189),'repo_root':_0xf48624,'search_type':_0x2357ff||_0x426f0e(0x28a)}),logger['debug'](_0x426f0e(0x285),'warp_grep_start',{'query':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'repo_root':_0xf48624,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x1171c3=Date[_0x426f0e(0x1f2)](),_0x2f776b=await runWarpGrep({'searchTerm':_0x16d1c7[_0x426f0e(0x1a0)]['search_string'],'repoRoot':_0xf48624,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x4892d1,'search_type':_0x2357ff}),_0x5b637c=Date['now']()-_0x1171c3,_0x38b456=_0x2f776b[_0x426f0e(0x192)]?.['metadata']?.[_0x426f0e(0x287)]?.[_0x426f0e(0x19a)]??0x0;logger[_0x426f0e(0x180)](_0x426f0e(0x285),_0x426f0e(0x1d8),{'termination':_0x2f776b[_0x426f0e(0x1f0)],'turns':_0x2f776b[_0x426f0e(0x25e)]?.['turns']??0x0,'files_found':_0x38b456,'latency_ms':_0x5b637c});const _0x429363=_0x5a292d(_0x2f776b['messages']);_0x429363['length']>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x429363['length']+'\x20error(s)','error_type':_0x426f0e(0x2ae),'level':'warn','tool':'codebase_search','context':{'repo_path':_0x16d1c7['data'][_0x426f0e(0x1fd)],'query':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'model':'morph-warp-grep-v2.1','termination_reason':_0x2f776b['terminationReason'],'sub_tool_errors':_0x429363,'timings':_0x2f776b[_0x426f0e(0x25e)],'tool_calls':_0x2f695c(_0x2f776b[_0x426f0e(0x275)]),'messages':_0x2f776b[_0x426f0e(0x275)]?.['map'](_0x4e9a15=>({'role':_0x4e9a15[_0x426f0e(0x237)],'content':_0x4e9a15[_0x426f0e(0x21a)],..._0x4e9a15['tool_calls']?{'tool_calls':_0x4e9a15[_0x426f0e(0x278)][_0x426f0e(0x19a)]}:{},..._0x4e9a15['tool_call_id']?{'tool_call_id':_0x4e9a15[_0x426f0e(0x1f3)]}:{}}))},'source':_0x426f0e(0x19b)})[_0x426f0e(0x209)](()=>{});let _0x2e9d71='';if(_0x2f776b['terminationReason']===_0x426f0e(0x2a3)&&_0x2f776b['finish']?.[_0x426f0e(0x20b)]?.['files']){const _0x5dde31=_0x2f776b[_0x426f0e(0x192)][_0x426f0e(0x20b)][_0x426f0e(0x287)];if(_0x5dde31[_0x426f0e(0x19a)]===0x0)return _0x2e9d71=_0x2f776b[_0x426f0e(0x192)][_0x426f0e(0x1dc)]||_0x426f0e(0x231),{'content':[{'type':_0x426f0e(0x23e),'text':_0x2e9d71}]};const _0x4bca2e=[],_0xc53af1=[_0x426f0e(0x1fc)];for(const _0xc90277 of _0x2f776b[_0x426f0e(0x275)]){if(_0xc90277[_0x426f0e(0x237)]===_0x426f0e(0x1f7)&&Array[_0x426f0e(0x290)](_0xc90277[_0x426f0e(0x278)]))for(const _0x296f07 of _0xc90277['tool_calls']){try{const _0x4c06c9=_0x296f07['function']?.['name'],_0x4d8d3b=JSON[_0x426f0e(0x20c)](_0x296f07[_0x426f0e(0x18a)]?.[_0x426f0e(0x1d9)]||'{}');if(_0x4c06c9===_0x426f0e(0x238))_0xc53af1[_0x426f0e(0x1a2)]('-\x20Grepped\x20\x27'+_0x4d8d3b['pattern']+_0x426f0e(0x2a1)+(_0x4d8d3b[_0x426f0e(0x26f)]||'.')+'`');else{if(_0x4c06c9===_0x426f0e(0x1b8))_0xc53af1[_0x426f0e(0x1a2)](_0x426f0e(0x214)+_0x4d8d3b['path']+'`');else{if(_0x4c06c9==='list_directory')_0xc53af1[_0x426f0e(0x1a2)](_0x426f0e(0x1ae)+(_0x4d8d3b[_0x426f0e(0x236)]||'.')+'`');else _0x4c06c9==='glob'&&_0xc53af1[_0x426f0e(0x1a2)](_0x426f0e(0x1ee)+_0x4d8d3b[_0x426f0e(0x1e3)]+_0x426f0e(0x27b)+(_0x4d8d3b[_0x426f0e(0x26f)]||'.')+'`');}}}catch{}}}_0x4bca2e['push'](_0xc53af1['join']('\x0a'));const _0x13788c=['',_0x426f0e(0x246)];for(const _0x18dae2 of _0x5dde31){if(_0x18dae2['lines']==='*')_0x13788c['push']('-\x20'+_0x18dae2[_0x426f0e(0x26f)]+':*');else{if(Array['isArray'](_0x18dae2[_0x426f0e(0x23a)])){const _0x4a4963=_0x18dae2['lines']['map'](([_0xc04d59,_0xd17907])=>{if(_0xc04d59===_0xd17907)return''+_0xc04d59;return _0xc04d59+'-'+_0xd17907;});_0x13788c[_0x426f0e(0x1a2)]('-\x20'+_0x18dae2[_0x426f0e(0x26f)]+':'+_0x4a4963[_0x426f0e(0x20e)](','));}else _0x13788c[_0x426f0e(0x1a2)]('-\x20'+_0x18dae2[_0x426f0e(0x26f)]+':*');}}_0x13788c['push'](''),_0x4bca2e['push'](_0x13788c[_0x426f0e(0x20e)]('\x0a')),_0x4bca2e[_0x426f0e(0x1a2)](_0x426f0e(0x255));const _0x132000=[],_0x21b1a1=[];for(const _0x55adf9 of _0x5dde31){let _0xd86ef=a0_0x4c88d7[_0x426f0e(0x24a)](_0x16d1c7[_0x426f0e(0x1a0)]['repo_path'],_0x55adf9[_0x426f0e(0x26f)]),_0x1c0122=null,_0x3a3cb2=null;try{_0x1c0122=await a0_0x5207e6[_0x426f0e(0x233)](_0xd86ef,{'encoding':'utf-8'});}catch(_0x118fcb){const _0x3246ee=fixPathRepetition(_0xd86ef);if(_0x3246ee)try{_0x1c0122=await a0_0x5207e6[_0x426f0e(0x233)](_0x3246ee,{'encoding':'utf-8'}),_0xd86ef=_0x3246ee;}catch{_0x3a3cb2=_0x118fcb instanceof Error?_0x118fcb:new Error(String(_0x118fcb));}else _0x3a3cb2=_0x118fcb instanceof Error?_0x118fcb:new Error(String(_0x118fcb));}if(_0x1c0122!==null){const _0x553f07=_0x1c0122[_0x426f0e(0x296)](/\r?\n/),_0xcba27d=[];if(_0x55adf9[_0x426f0e(0x23a)]==='*'||!Array['isArray'](_0x55adf9['lines']))for(let _0x46f4b1=0x1;_0x46f4b1<=_0x553f07[_0x426f0e(0x19a)];_0x46f4b1++){const _0x1f16c3=_0x553f07[_0x46f4b1-0x1];_0xcba27d[_0x426f0e(0x1a2)](_0x46f4b1+'|\x20'+_0x1f16c3);}else for(const [_0x4f1697,_0x2a8ea5]of _0x55adf9['lines']){_0xcba27d[_0x426f0e(0x19a)]>0x0&&_0xcba27d[_0x426f0e(0x1a2)]('');for(let _0x3573c3=_0x4f1697;_0x3573c3<=_0x2a8ea5&&_0x3573c3<=_0x553f07[_0x426f0e(0x19a)];_0x3573c3++){const _0x16fbe7=_0x553f07[_0x3573c3-0x1];_0xcba27d[_0x426f0e(0x1a2)](_0x3573c3+'|\x20'+_0x16fbe7);}}_0x21b1a1[_0x426f0e(0x1a2)]({'path':_0x55adf9[_0x426f0e(0x26f)],'content':_0xcba27d[_0x426f0e(0x20e)]('\x0a')});}else _0x132000[_0x426f0e(0x1a2)](_0x426f0e(0x1d3)+_0x55adf9[_0x426f0e(0x26f)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x3a3cb2?.[_0x426f0e(0x282)]||_0x426f0e(0x229))+_0x426f0e(0x22d));}try{const _0x2625aa=await compactFileContexts(_0x21b1a1,_0x16d1c7['data'][_0x426f0e(0x221)],MORPH_API_KEY,MORPH_API_URL);for(const _0x33ea4f of _0x2625aa){_0x132000[_0x426f0e(0x1a2)](_0x426f0e(0x1d3)+_0x33ea4f[_0x426f0e(0x26f)]+'\x22>\x0a'+_0x33ea4f['content']+'\x0a</file>');}}catch(_0x2ae193){logger[_0x426f0e(0x217)](_0x426f0e(0x285),_0x426f0e(0x1ff),{'error':_0x2ae193 instanceof Error?_0x2ae193[_0x426f0e(0x282)]:String(_0x2ae193),'files_count':_0x21b1a1[_0x426f0e(0x19a)]});for(const _0x3f9c3 of _0x21b1a1){_0x132000[_0x426f0e(0x1a2)](_0x426f0e(0x1d3)+_0x3f9c3[_0x426f0e(0x26f)]+_0x426f0e(0x1f5)+_0x3f9c3[_0x426f0e(0x21a)]+_0x426f0e(0x22d));}}_0x4bca2e[_0x426f0e(0x1a2)](_0x132000[_0x426f0e(0x20e)]('\x0a\x0a')),_0x2e9d71=_0x4bca2e[_0x426f0e(0x20e)]('\x0a');const _0x5e85e8=_0x2f776b[_0x426f0e(0x218)]?.[_0x426f0e(0x268)](_0x4d3762=>_0x4d3762[_0x426f0e(0x282)]?.['startsWith'](_0x426f0e(0x1f1)))||[];if(_0x5e85e8['length']>0x0){const _0x44a081=_0x5e85e8[_0x426f0e(0x185)](_0x44f1ea=>_0x44f1ea[_0x426f0e(0x282)])[_0x426f0e(0x20e)](';\x20');reportMorphError({'error_message':_0x44a081,'error_type':_0x426f0e(0x25d),'context':{'tool':_0x426f0e(0x1e1),'repo_path':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x1fd)],'query':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'model':'morph-warp-grep-v2.1','termination_reason':_0x426f0e(0x198),'error_count':_0x5e85e8[_0x426f0e(0x19a)],'is_timeout':![],'timings':_0x2f776b['timings'],'files_attempted':_0x5dde31[_0x426f0e(0x185)](_0x3dd36a=>({'path':_0x3dd36a[_0x426f0e(0x26f)],'lines':_0x3dd36a[_0x426f0e(0x23a)]})),'tool_calls':_0x2f695c(_0x2f776b[_0x426f0e(0x275)]),'messages':_0x2f776b['messages']?.[_0x426f0e(0x185)](_0x30d88f=>({'role':_0x30d88f[_0x426f0e(0x237)],'content':_0x30d88f['content'],..._0x30d88f[_0x426f0e(0x278)]?{'tool_calls':_0x30d88f[_0x426f0e(0x278)][_0x426f0e(0x19a)]}:{},..._0x30d88f[_0x426f0e(0x1f3)]?{'tool_call_id':_0x30d88f[_0x426f0e(0x1f3)]}:{}})),'request_content':{'query':_0x16d1c7[_0x426f0e(0x1a0)]['search_string'],'repo_path':_0x16d1c7['data'][_0x426f0e(0x1fd)],'repoRoot':a0_0x4c88d7[_0x426f0e(0x24a)](_0x16d1c7[_0x426f0e(0x1a0)]['repo_path']),'model':_0x426f0e(0x1e7)}},'source':_0x426f0e(0x19b)})[_0x426f0e(0x209)](()=>{});}}else{if(_0x2f776b[_0x426f0e(0x1f0)]===_0x426f0e(0x1b6)&&_0x2f776b[_0x426f0e(0x218)][_0x426f0e(0x19a)]>0x0){const _0x38ef2f=_0x2f776b[_0x426f0e(0x218)][_0x426f0e(0x185)](_0x1a34a4=>_0x1a34a4['message'])[_0x426f0e(0x20e)](';\x20');_0x2e9d71='Error:\x20'+_0x38ef2f;const _0x9daf02=_0x38ef2f[_0x426f0e(0x28c)]()[_0x426f0e(0x228)](_0x426f0e(0x29f))||_0x38ef2f[_0x426f0e(0x28c)]()[_0x426f0e(0x228)]('timed\x20out')||_0x38ef2f[_0x426f0e(0x28c)]()[_0x426f0e(0x228)](_0x426f0e(0x20a)),_0x59290c=_0x2f776b[_0x426f0e(0x192)]?.[_0x426f0e(0x20b)]?.[_0x426f0e(0x287)],_0x434b84=_0x2f776b[_0x426f0e(0x218)][0x0];reportMorphError({'error_message':_0x38ef2f,'error_type':_0x9daf02?_0x426f0e(0x1ad):_0x434b84?.[_0x426f0e(0x289)]?.['name']||'WarpGrepError','context':{'tool':_0x426f0e(0x1e1),'repo_path':_0x16d1c7['data']['repo_path'],'query':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'model':_0x426f0e(0x1e7),'termination_reason':_0x2f776b[_0x426f0e(0x1f0)],'error_count':_0x2f776b[_0x426f0e(0x218)][_0x426f0e(0x19a)],'is_timeout':_0x9daf02,'timings':_0x2f776b['timings'],'files_attempted':_0x59290c?.[_0x426f0e(0x185)](_0x11adc7=>({'path':_0x11adc7[_0x426f0e(0x26f)],'lines':_0x11adc7['lines']})),'tool_calls':_0x2f695c(_0x2f776b['messages']),'messages':_0x2f776b['messages']?.[_0x426f0e(0x185)](_0x36bcd2=>({'role':_0x36bcd2['role'],'content':_0x36bcd2['content'],..._0x36bcd2['tool_calls']?{'tool_calls':_0x36bcd2[_0x426f0e(0x278)][_0x426f0e(0x19a)]}:{},..._0x36bcd2[_0x426f0e(0x1f3)]?{'tool_call_id':_0x36bcd2[_0x426f0e(0x1f3)]}:{}})),'request_content':{'query':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'repo_path':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x1fd)],'repoRoot':a0_0x4c88d7[_0x426f0e(0x24a)](_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x1fd)]),'model':_0x426f0e(0x1e7)}},'stack_trace':_0x434b84?.[_0x426f0e(0x1b2)]||undefined,'source':_0x426f0e(0x19b)})[_0x426f0e(0x209)](()=>{});}else _0x2e9d71=_0x426f0e(0x2aa);}return{'content':[{'type':_0x426f0e(0x23e),'text':_0x2e9d71}]};}catch(_0x2ecf41){const _0xf8af4e=handleMorphAPIError(_0x2ecf41);if(_0xf8af4e)return logger[_0x426f0e(0x29c)](_0x426f0e(0x285),_0x426f0e(0x22e),{'tool':_0x426f0e(0x1e1),'error':_0x426f0e(0x25b),'latency_ms':Date['now']()-_0x19a68a}),_0xf8af4e;const _0x4a223f=_0x2ecf41 instanceof Error?_0x2ecf41[_0x426f0e(0x282)]:String(_0x2ecf41);logger[_0x426f0e(0x29c)]('MCP',_0x426f0e(0x22e),{'tool':_0x426f0e(0x1e1),'error':_0x4a223f,'repo_path':_0x16d1c7['data'][_0x426f0e(0x1fd)],'query':_0x16d1c7[_0x426f0e(0x1a0)]['search_string'],'latency_ms':Date[_0x426f0e(0x1f2)]()-_0x19a68a});const _0x2fe6db=_0x4a223f[_0x426f0e(0x28c)]()[_0x426f0e(0x228)](_0x426f0e(0x29f))||_0x4a223f[_0x426f0e(0x28c)]()[_0x426f0e(0x228)](_0x426f0e(0x2a7))||_0x4a223f[_0x426f0e(0x28c)]()[_0x426f0e(0x228)](_0x426f0e(0x20a))||_0x2ecf41 instanceof Error&&_0x2ecf41[_0x426f0e(0x1ed)]===_0x426f0e(0x1ad);return reportMorphError({'error_message':_0x4a223f,'error_type':_0x2fe6db?_0x426f0e(0x1ad):_0x2ecf41 instanceof Error?_0x2ecf41[_0x426f0e(0x289)]['name']:_0x426f0e(0x1be),'context':{'tool':'codebase_search','repo_path':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x1fd)],'query':_0x16d1c7[_0x426f0e(0x1a0)]['search_string'],'model':_0x426f0e(0x1e7),'is_timeout':_0x2fe6db,'exception_phase':_0x426f0e(0x216),'request_content':{'query':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'repo_path':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x1fd)],'repoRoot':a0_0x4c88d7['resolve'](_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x1fd)]),'model':_0x426f0e(0x1e7)}},'stack_trace':_0x2ecf41 instanceof Error?_0x2ecf41[_0x426f0e(0x1b2)]:undefined,'source':_0x426f0e(0x19b)})[_0x426f0e(0x209)](()=>{}),{'content':[{'type':_0x426f0e(0x23e),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x4a223f}],'isError':![]};}}case TOOL_NAMES[_0x426f0e(0x1e9)]:{const _0x59c49a=WarpGrepGitHubArgsSchema[_0x426f0e(0x252)](_0x4aeb44);if(!_0x59c49a[_0x426f0e(0x1d5)])return{'content':[{'type':_0x426f0e(0x23e),'text':_0x426f0e(0x203)+_0x59c49a[_0x426f0e(0x29c)]}],'isError':!![]};const _0x5ed080=_0x59c49a['data'][_0x426f0e(0x222)]||_0x59c49a['data'][_0x426f0e(0x21f)];if(!_0x5ed080)return{'content':[{'type':_0x426f0e(0x23e),'text':_0x426f0e(0x182)}],'isError':!![]};const _0x2de418=MORPH_API_KEY;if(!_0x2de418)throw new Error(_0x426f0e(0x19c));const _0x32b20d=Date[_0x426f0e(0x1f2)]();logger[_0x426f0e(0x180)](_0x426f0e(0x285),_0x426f0e(0x1fb),{'identifier':_0x5ed080,'query':_0x59c49a[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'branch':_0x59c49a[_0x426f0e(0x1a0)]['branch']});try{const _0x1c5e93=new WarpGrepClient({'morphApiKey':_0x2de418,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x484191=await _0x1c5e93[_0x426f0e(0x264)]({'searchTerm':_0x59c49a['data'][_0x426f0e(0x221)],'github':_0x5ed080,'branch':_0x59c49a[_0x426f0e(0x1a0)][_0x426f0e(0x25a)]}),_0x5e6a5c=Date['now']()-_0x32b20d;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x5e6a5c+_0x426f0e(0x181)+_0x484191['success']);const _0x376aa2=formatResult(_0x484191);return{'content':[{'type':'text','text':_0x376aa2}]};}catch(_0x42fee7){const _0x5117e9=handleMorphAPIError(_0x42fee7);if(_0x5117e9)return _0x5117e9;const _0x2d9692=Date['now']()-_0x32b20d,_0x5dceb3=_0x42fee7 instanceof Error?_0x42fee7['message']:String(_0x42fee7);return logMcpStderr(_0x426f0e(0x26e)+_0x2d9692+_0x426f0e(0x26a),_0x5dceb3),reportMorphError({'error_message':_0x5dceb3,'error_type':_0x42fee7 instanceof Error?_0x42fee7[_0x426f0e(0x289)][_0x426f0e(0x1ed)]:_0x426f0e(0x1be),'context':{'tool':_0x426f0e(0x29b),'github_url':_0x5ed080,'search_string':_0x59c49a[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'branch':_0x59c49a[_0x426f0e(0x1a0)]['branch']},'stack_trace':_0x42fee7 instanceof Error?_0x42fee7[_0x426f0e(0x1b2)]:undefined,'source':'mcp-filesystem','tool':'github_codebase_search','latency_ms':_0x2d9692})[_0x426f0e(0x209)](()=>{}),{'content':[{'type':_0x426f0e(0x23e),'text':'GitHub\x20search\x20failed:\x20'+_0x5dceb3}],'isError':![]};}}default:throw new Error(_0x426f0e(0x270)+_0x5e3c72);}}catch(_0x3f68ce){const _0x3b344f=_0x3f68ce instanceof Error?_0x3f68ce[_0x426f0e(0x282)]:String(_0x3f68ce);return reportMorphError({'error_message':_0x3b344f,'error_type':_0x3f68ce instanceof Error?_0x3f68ce['constructor']['name']:_0x426f0e(0x1be),'context':{'tool':_0x5e3c72,'arguments':_0x4aeb44?JSON[_0x426f0e(0x200)](_0x4aeb44)['substring'](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x3f68ce instanceof Error?_0x3f68ce['stack']:undefined,'source':_0x426f0e(0x19b)})['catch'](()=>{}),{'content':[{'type':_0x426f0e(0x23e),'text':_0x426f0e(0x21c)+_0x3b344f}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x54321f){const _0x258869=a0_0x240656,_0x2a9324=await getValidRootDirectories(_0x54321f);if(_0x2a9324[_0x258869(0x19a)]>0x0)allowedDirectories=[..._0x2a9324],logMcpStderr('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x2a9324['length']+_0x258869(0x17d));else{logMcpStderr(_0x258869(0x24d));if(ENABLE_WORKSPACE_MODE)try{const _0x1f74dc=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x1f74dc&&(allowedDirectories=[_0x1f74dc],logMcpStderr(_0x258869(0x1c2)+_0x1f74dc));}catch(_0x94dbaf){logMcpStderr(_0x258869(0x25f)+_0x94dbaf);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x345da7=a0_0x240656;try{const _0x549c5d=await server[_0x345da7(0x1ef)]();_0x549c5d&&'roots'in _0x549c5d&&await updateAllowedDirectoriesFromRoots(_0x549c5d['roots']);}catch(_0x56a4ea){logMcpStderr(_0x345da7(0x1b9),_0x56a4ea instanceof Error?_0x56a4ea[_0x345da7(0x282)]:String(_0x56a4ea));}}),server[a0_0x240656(0x18f)]=async()=>{const _0x2170ec=a0_0x240656,_0x8fb490=server['getClientCapabilities']();if(_0x8fb490?.[_0x2170ec(0x274)])try{const _0x2a7957=await server['listRoots']();_0x2a7957&&_0x2170ec(0x274)in _0x2a7957?await updateAllowedDirectoriesFromRoots(_0x2a7957[_0x2170ec(0x274)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x327325){logMcpStderr(_0x2170ec(0x1ec),_0x327325 instanceof Error?_0x327325[_0x2170ec(0x282)]:String(_0x327325));}else{if(allowedDirectories[_0x2170ec(0x19a)]>0x0)logMcpStderr(_0x2170ec(0x201),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x2170ec(0x276));else throw new Error(_0x2170ec(0x1c7));}}};async function runServer(){const _0x59153a=a0_0x240656,_0x25aecc=new StdioServerTransport();await server[_0x59153a(0x258)](_0x25aecc),logMcpStderr(_0x59153a(0x215)),allowedDirectories[_0x59153a(0x19a)]===0x0&&logMcpStderr(_0x59153a(0x220));}runServer()[a0_0x240656(0x209)](_0x2eaf9d=>{const _0x2f9cad=a0_0x240656;logMcpStderr(_0x2f9cad(0x1b5),_0x2eaf9d),process['exit'](0x1);});
|
package/dist/log-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var a1_0x144558=a1_0x2aa2;(function(_0x1c5d7b,_0xafa634){var _0x307f33=a1_0x2aa2,_0x1ff498=_0x1c5d7b();while(!![]){try{var _0x95e60b=-parseInt(_0x307f33(0x14c))/0x1+parseInt(_0x307f33(0x15c))/0x2+parseInt(_0x307f33(0x151))/0x3*(-parseInt(_0x307f33(0x150))/0x4)+-parseInt(_0x307f33(0x156))/0x5+-parseInt(_0x307f33(0x14f))/0x6*(-parseInt(_0x307f33(0x14d))/0x7)+parseInt(_0x307f33(0x15e))/0x8*(parseInt(_0x307f33(0x14b))/0x9)+parseInt(_0x307f33(0x153))/0xa;if(_0x95e60b===_0xafa634)break;else _0x1ff498['push'](_0x1ff498['shift']());}catch(_0x3368f5){_0x1ff498['push'](_0x1ff498['shift']());}}}(a1_0xb580,0x8c3d8));function a1_0x2aa2(_0x34332a,_0x260b67){_0x34332a=_0x34332a-0x14b;var _0xb580c=a1_0xb580();var _0x2aa24a=_0xb580c[_0x34332a];return _0x2aa24a;}import a1_0x3df17b from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x637548=a1_0x3df17b['platform']()){var _0x1b50c1=a1_0x2aa2;switch(_0x637548){case'darwin':return _0x1b50c1(0x158);case _0x1b50c1(0x154):return _0x1b50c1(0x15a);case _0x1b50c1(0x15d):return _0x1b50c1(0x157);default:return'Unknown';}}export function formatMcpLogMessage(_0x4904ba,_0x224533=a1_0x3df17b[a1_0x144558(0x155)]()){return'[os='+getOperatingSystemType(_0x224533)+']\x20'+_0x4904ba;}export function logMcpStderr(_0x2ce46d,..._0x1f25ba){var _0x1ca646=a1_0x144558;console[_0x1ca646(0x152)](formatMcpLogMessage(_0x2ce46d),..._0x1f25ba),logger[_0x1ca646(0x15b)](_0x1ca646(0x14e),_0x2ce46d,_0x1f25ba[_0x1ca646(0x159)]?{'args':_0x1f25ba['map'](_0x420ca5=>String(_0x420ca5))}:undefined);}function a1_0xb580(){var _0x17460f=['MCP','6751314pRsXor','77416zhNmxp','45MhwmNG','error','3217300wibDQj','win32','platform','331420fAacHM','Linux','macOS','length','Windows','info','535224gZXZiC','linux','1492880UJFwBD','9qrFXAO','970153KAIhbh','7jwryBY'];a1_0xb580=function(){return _0x17460f;};return a1_0xb580();}
|
package/dist/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a2_0x4a0a(_0x4fbb5b,_0x296cc1){_0x4fbb5b=_0x4fbb5b-0x140;const _0x4f7219=a2_0x4f72();let _0x4a0a14=_0x4f7219[_0x4fbb5b];return _0x4a0a14;}const a2_0x10925a=a2_0x4a0a;(function(_0x2854e2,_0x5150a5){const _0x2bd8f2=a2_0x4a0a,_0x250f24=_0x2854e2();while(!![]){try{const _0x55f75e=-parseInt(_0x2bd8f2(0x153))/0x1+parseInt(_0x2bd8f2(0x14d))/0x2+parseInt(_0x2bd8f2(0x154))/0x3*(parseInt(_0x2bd8f2(0x14e))/0x4)+parseInt(_0x2bd8f2(0x152))/0x5+-parseInt(_0x2bd8f2(0x157))/0x6+parseInt(_0x2bd8f2(0x148))/0x7*(-parseInt(_0x2bd8f2(0x147))/0x8)+-parseInt(_0x2bd8f2(0x151))/0x9*(-parseInt(_0x2bd8f2(0x155))/0xa);if(_0x55f75e===_0x5150a5)break;else _0x250f24['push'](_0x250f24['shift']());}catch(_0x35e288){_0x250f24['push'](_0x250f24['shift']());}}}(a2_0x4f72,0x9a553));function a2_0x4f72(){const _0x16e255=['toISOString','fileStream',']\x20[','debug','5440RVOEVI','4179kferBq','warn','enabled','stringify','toUpperCase','1584624WyFJPU','1320INTOkc','env','info','9TLqvLV','1761150gUOFjI','911175JVjNuP','7347eQnOke','9375830uoKXsu','enable','5646078MGscHU','error','MORPH_DEBUG','MORPH_LOG_FILE','_log'];a2_0x4f72=function(){return _0x16e255;};return a2_0x4f72();}import{createWriteStream}from'fs';class MorphLogger{['enabled'];[a2_0x10925a(0x144)];constructor(){const _0x24409a=a2_0x10925a;this['enabled']=process[_0x24409a(0x14f)][_0x24409a(0x140)]==='1'||!!process[_0x24409a(0x14f)][_0x24409a(0x141)];const _0x5a5973=process[_0x24409a(0x14f)]['MORPH_LOG_FILE'];this[_0x24409a(0x144)]=_0x5a5973?createWriteStream(_0x5a5973,{'flags':'a'}):null;}[a2_0x10925a(0x146)](_0x5860d4,_0x59af30,_0x484170){const _0x1aa8ad=a2_0x10925a;this['_log'](_0x1aa8ad(0x146),_0x5860d4,_0x59af30,_0x484170);}[a2_0x10925a(0x150)](_0x1dfb47,_0x4c2276,_0xa3eeeb){const _0x2ae03f=a2_0x10925a;this[_0x2ae03f(0x142)](_0x2ae03f(0x150),_0x1dfb47,_0x4c2276,_0xa3eeeb);}['warn'](_0x1eba7f,_0x2e1294,_0x54a6c0){const _0x479d93=a2_0x10925a;this[_0x479d93(0x142)](_0x479d93(0x149),_0x1eba7f,_0x2e1294,_0x54a6c0);}[a2_0x10925a(0x158)](_0x2be30a,_0x1d8717,_0x4a0074){const _0x5a4824=a2_0x10925a;this[_0x5a4824(0x142)](_0x5a4824(0x158),_0x2be30a,_0x1d8717,_0x4a0074);}[a2_0x10925a(0x156)](){const _0x53be0b=a2_0x10925a;this[_0x53be0b(0x14a)]=!![];}get['isEnabled'](){const _0x26674d=a2_0x10925a;return this[_0x26674d(0x14a)];}['_log'](_0x3600a0,_0x35c607,_0xca7f4c,_0x8c6bd4){const _0x397c61=a2_0x10925a;if(_0x3600a0!==_0x397c61(0x158)&&!this[_0x397c61(0x14a)])return;const _0x38eb0b=new Date()[_0x397c61(0x143)](),_0x1323cc='['+_0x38eb0b+_0x397c61(0x145)+_0x3600a0[_0x397c61(0x14c)]()+_0x397c61(0x145)+_0x35c607+']';console[_0x397c61(0x158)](_0x8c6bd4?_0x1323cc+'\x20'+_0xca7f4c+'\x20'+JSON[_0x397c61(0x14b)](_0x8c6bd4):_0x1323cc+'\x20'+_0xca7f4c),this['fileStream']?.['write'](JSON[_0x397c61(0x14b)]({'ts':_0x38eb0b,'level':_0x3600a0,'component':_0x35c607,'msg':_0xca7f4c,..._0x8c6bd4&&{'data':_0x8c6bd4}})+'\x0a');}}export const logger=new MorphLogger();
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x38ba32,_0x396db9){const _0x494d06=a3_0x570e,_0x18658a=_0x38ba32();while(!![]){try{const _0x2d44f7=-parseInt(_0x494d06(0xa1))/0x1+parseInt(_0x494d06(0x96))/0x2+-parseInt(_0x494d06(0x99))/0x3+parseInt(_0x494d06(0x9d))/0x4+-parseInt(_0x494d06(0xa6))/0x5*(parseInt(_0x494d06(0xa2))/0x6)+parseInt(_0x494d06(0x9a))/0x7+-parseInt(_0x494d06(0x9e))/0x8*(-parseInt(_0x494d06(0x95))/0x9);if(_0x2d44f7===_0x396db9)break;else _0x18658a['push'](_0x18658a['shift']());}catch(_0x14b44e){_0x18658a['push'](_0x18658a['shift']());}}}(a3_0x48bf,0xae490));function a3_0x570e(_0x383dad,_0x6cf6b){_0x383dad=_0x383dad-0x95;const _0x48bfa2=a3_0x48bf();let _0x570ea2=_0x48bfa2[_0x383dad];return _0x570ea2;}import a3_0x4fc87b from'path';import a3_0x31372e from'os';export function convertToWindowsPath(_0x3a22cc){const _0x38ac21=a3_0x570e;if(_0x3a22cc['startsWith']('/mnt/')){const _0x2ce60d=_0x3a22cc[_0x38ac21(0x9b)](0x5)[_0x38ac21(0xa3)](),_0x49b037=_0x3a22cc['slice'](0x6)[_0x38ac21(0x97)](/\//g,'\x5c');return _0x2ce60d+':'+_0x49b037;}if(_0x3a22cc[_0x38ac21(0xa4)](/^\/[a-zA-Z]\//)){const _0x2c11c8=_0x3a22cc[_0x38ac21(0x9b)](0x1)[_0x38ac21(0xa3)](),_0x116e0c=_0x3a22cc['slice'](0x2)[_0x38ac21(0x97)](/\//g,'\x5c');return _0x2c11c8+':'+_0x116e0c;}if(_0x3a22cc[_0x38ac21(0xa4)](/^[a-zA-Z]:/))return _0x3a22cc[_0x38ac21(0x97)](/\//g,'\x5c');return _0x3a22cc;}export function normalizePath(_0x4f2b9c){const _0x5c3c57=a3_0x570e;_0x4f2b9c=_0x4f2b9c[_0x5c3c57(0xa5)]()['replace'](/^["']|["']$/g,'');const _0xccef89=_0x4f2b9c[_0x5c3c57(0x9f)]('/')&&!_0x4f2b9c[_0x5c3c57(0xa4)](/^\/mnt\/[a-z]\//i)&&!_0x4f2b9c['match'](/^\/[a-zA-Z]\//);if(_0xccef89)return _0x4f2b9c[_0x5c3c57(0x97)](/\/+/g,'/')[_0x5c3c57(0x97)](/\/+$/,'');_0x4f2b9c=convertToWindowsPath(_0x4f2b9c);if(_0x4f2b9c[_0x5c3c57(0x9f)]('\x5c\x5c')){let _0x18e48c=_0x4f2b9c;_0x18e48c=_0x18e48c[_0x5c3c57(0x97)](/^\\{2,}/,'\x5c\x5c');const _0x28fae0=_0x18e48c['substring'](0x2)['replace'](/\\\\/g,'\x5c');_0x4f2b9c='\x5c\x5c'+_0x28fae0;}else _0x4f2b9c=_0x4f2b9c['replace'](/\\\\/g,'\x5c');let _0x5da78b=a3_0x4fc87b[_0x5c3c57(0x9c)](_0x4f2b9c);_0x4f2b9c['startsWith']('\x5c\x5c')&&!_0x5da78b[_0x5c3c57(0x9f)]('\x5c\x5c')&&(_0x5da78b='\x5c'+_0x5da78b);if(_0x5da78b['match'](/^[a-zA-Z]:/)){let _0xe830b3=_0x5da78b[_0x5c3c57(0x97)](/\//g,'\x5c');return/^[a-z]:/[_0x5c3c57(0x98)](_0xe830b3)&&(_0xe830b3=_0xe830b3['charAt'](0x0)[_0x5c3c57(0xa3)]()+_0xe830b3[_0x5c3c57(0xa7)](0x1)),_0xe830b3;}return _0x5da78b[_0x5c3c57(0x97)](/\//g,'\x5c');}export function expandHome(_0x5170d5){const _0x5118a1=a3_0x570e;if(_0x5170d5[_0x5118a1(0x9f)]('~/')||_0x5170d5==='~')return a3_0x4fc87b[_0x5118a1(0xa0)](a3_0x31372e['homedir'](),_0x5170d5['slice'](0x1));return _0x5170d5;}function a3_0x48bf(){const _0xde3b85=['5OQGOgl','slice','18435969hPbcEw','1811450HwajUn','replace','test','4250400pArNJT','3302306SzLgdf','charAt','normalize','2352904HIZznr','8sdQckg','startsWith','join','767554HQsKDP','6695544lIlZZc','toUpperCase','match','trim'];a3_0x48bf=function(){return _0xde3b85;};return a3_0x48bf();}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x44d4a6,_0x239c07){const _0x4a89d6=a4_0x4044,_0x45a028=_0x44d4a6();while(!![]){try{const _0xab00d5=parseInt(_0x4a89d6(0x10e))/0x1+parseInt(_0x4a89d6(0x10d))/0x2*(parseInt(_0x4a89d6(0x109))/0x3)+parseInt(_0x4a89d6(0x113))/0x4+parseInt(_0x4a89d6(0x115))/0x5*(parseInt(_0x4a89d6(0x10f))/0x6)+parseInt(_0x4a89d6(0x104))/0x7*(-parseInt(_0x4a89d6(0x108))/0x8)+-parseInt(_0x4a89d6(0x111))/0x9*(-parseInt(_0x4a89d6(0x10c))/0xa)+-parseInt(_0x4a89d6(0x105))/0xb;if(_0xab00d5===_0x239c07)break;else _0x45a028['push'](_0x45a028['shift']());}catch(_0x45f071){_0x45a028['push'](_0x45a028['shift']());}}}(a4_0x2de3,0x94f16));import a4_0x18f966 from'path';export function isPathWithinAllowedDirectories(_0x2dd783,_0x21fcc9){const _0x5c76f9=a4_0x4044;if(typeof _0x2dd783!=='string'||!Array[_0x5c76f9(0x10b)](_0x21fcc9))return![];if(!_0x2dd783||_0x21fcc9[_0x5c76f9(0x110)]===0x0)return![];if(_0x2dd783[_0x5c76f9(0x103)]('\x00'))return![];let _0x16ae00;try{_0x16ae00=a4_0x18f966[_0x5c76f9(0x10a)](a4_0x18f966['normalize'](_0x2dd783));}catch{return![];}if(!a4_0x18f966[_0x5c76f9(0x107)](_0x16ae00))throw new Error(_0x5c76f9(0x112));return _0x21fcc9[_0x5c76f9(0x114)](_0x5f42de=>{const _0x54ed39=_0x5c76f9;if(typeof _0x5f42de!=='string'||!_0x5f42de)return![];if(_0x5f42de[_0x54ed39(0x103)]('\x00'))return![];let _0x30a9ad;try{_0x30a9ad=a4_0x18f966[_0x54ed39(0x10a)](a4_0x18f966['normalize'](_0x5f42de));}catch{return![];}if(!a4_0x18f966['isAbsolute'](_0x30a9ad))throw new Error(_0x54ed39(0x106));if(_0x16ae00===_0x30a9ad)return!![];if(_0x30a9ad===a4_0x18f966['sep'])return _0x16ae00[_0x54ed39(0x102)](a4_0x18f966[_0x54ed39(0x101)]);return _0x16ae00[_0x54ed39(0x102)](_0x30a9ad+a4_0x18f966[_0x54ed39(0x101)]);});}function a4_0x4044(_0x4e2791,_0x50fcb6){_0x4e2791=_0x4e2791-0x101;const _0x2de382=a4_0x2de3();let _0x40440=_0x2de382[_0x4e2791];return _0x40440;}function a4_0x2de3(){const _0x5cb1bd=['includes','7LQjWWy','12816760dgyMNB','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','isAbsolute','1024056XjcNCO','12EEBfdu','resolve','isArray','6965690pHTPcu','46390sDzwJd','30782hIQrIg','35202GkdXhs','length','9giyjkk','Path\x20must\x20be\x20absolute\x20after\x20normalization','3440640UOLuwo','some','190MLxFHd','sep','startsWith'];a4_0x2de3=function(){return _0x5cb1bd;};return a4_0x2de3();}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x24c67d,_0x5a37b2){const _0x2869fd=a5_0x3866,_0x39ac81=_0x24c67d();while(!![]){try{const _0x30b305=-parseInt(_0x2869fd(0x10e))/0x1+parseInt(_0x2869fd(0x11d))/0x2*(-parseInt(_0x2869fd(0x10b))/0x3)+-parseInt(_0x2869fd(0x107))/0x4*(-parseInt(_0x2869fd(0x10d))/0x5)+-parseInt(_0x2869fd(0x11b))/0x6+parseInt(_0x2869fd(0x10c))/0x7*(parseInt(_0x2869fd(0x114))/0x8)+-parseInt(_0x2869fd(0x106))/0x9+-parseInt(_0x2869fd(0x11e))/0xa*(-parseInt(_0x2869fd(0x112))/0xb);if(_0x30b305===_0x5a37b2)break;else _0x39ac81['push'](_0x39ac81['shift']());}catch(_0x505c0b){_0x39ac81['push'](_0x39ac81['shift']());}}}(a5_0x3778,0xeea45));import{promises as a5_0x1adc2d}from'fs';import a5_0x3d8a44 from'path';import a5_0x552569 from'os';function a5_0x3866(_0x310679,_0x25c23a){_0x310679=_0x310679-0x106;const _0x37784a=a5_0x3778();let _0x38669b=_0x37784a[_0x310679];return _0x38669b;}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x1130e0){const _0x20e210=a5_0x3866;try{const _0x5dcb2a=_0x1130e0[_0x20e210(0x117)](_0x20e210(0x10f))?_0x1130e0[_0x20e210(0x119)](0x7):_0x1130e0,_0x5eb71a=_0x5dcb2a['startsWith']('~/')||_0x5dcb2a==='~'?a5_0x3d8a44['join'](a5_0x552569[_0x20e210(0x11c)](),_0x5dcb2a[_0x20e210(0x119)](0x1)):_0x5dcb2a,_0x401131=a5_0x3d8a44['resolve'](_0x5eb71a),_0x41ebf7=await a5_0x1adc2d[_0x20e210(0x116)](_0x401131);return normalizePath(_0x41ebf7);}catch{return null;}}function formatDirectoryError(_0x474e6d,_0x389f05,_0x2e8eae){const _0x4a798f=a5_0x3866;if(_0x2e8eae)return _0x4a798f(0x113)+_0x2e8eae+':\x20'+_0x474e6d;const _0x3b21ec=_0x389f05 instanceof Error?_0x389f05[_0x4a798f(0x11a)]:String(_0x389f05);return _0x4a798f(0x10a)+_0x474e6d+_0x4a798f(0x108)+_0x3b21ec;}function a5_0x3778(){const _0x88318a=['536374eqUkoj','file://','non-directory\x20root','uri','8076464HiOvMZ','Skipping\x20','26152UKbKvG','stat','realpath','startsWith','invalid\x20path\x20or\x20inaccessible','slice','message','5633394hENDOZ','homedir','8iJvhfK','40stsXFr','16999938luzJFm','4594588qzFEvA','\x20due\x20to\x20error:\x20','push','Skipping\x20invalid\x20directory:\x20','957804ekbSKR','3283xMpdHN','5bzBQTt'];a5_0x3778=function(){return _0x88318a;};return a5_0x3778();}export async function getValidRootDirectories(_0x2f74a0){const _0xed7f47=a5_0x3866,_0x456a1f=[];for(const _0x4de639 of _0x2f74a0){const _0x12cdbd=await parseRootUri(_0x4de639[_0xed7f47(0x111)]);if(!_0x12cdbd){logMcpStderr(formatDirectoryError(_0x4de639[_0xed7f47(0x111)],undefined,_0xed7f47(0x118)));continue;}try{const _0x923d76=await a5_0x1adc2d[_0xed7f47(0x115)](_0x12cdbd);_0x923d76['isDirectory']()?_0x456a1f[_0xed7f47(0x109)](_0x12cdbd):logMcpStderr(formatDirectoryError(_0x12cdbd,undefined,_0xed7f47(0x110)));}catch(_0x13e959){logMcpStderr(formatDirectoryError(_0x12cdbd,_0x13e959));}}return _0x456a1f;}
|
package/dist/tool-definitions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a6_0xf86421=a6_0x436a;function a6_0x436a(_0x1eeb75,_0x469b4d){_0x1eeb75=_0x1eeb75-0xa7;const _0x3b0d07=a6_0x3b0d();let _0x436a30=_0x3b0d07[_0x1eeb75];return _0x436a30;}(function(_0x73b749,_0x152f44){const _0xd8f950=a6_0x436a,_0x35f1c0=_0x73b749();while(!![]){try{const _0x3326c9=parseInt(_0xd8f950(0xb1))/0x1+parseInt(_0xd8f950(0xad))/0x2+parseInt(_0xd8f950(0xa9))/0x3*(parseInt(_0xd8f950(0xaa))/0x4)+parseInt(_0xd8f950(0xaf))/0x5+-parseInt(_0xd8f950(0xab))/0x6*(-parseInt(_0xd8f950(0xb2))/0x7)+parseInt(_0xd8f950(0xae))/0x8+parseInt(_0xd8f950(0xb4))/0x9*(-parseInt(_0xd8f950(0xa8))/0xa);if(_0x3326c9===_0x152f44)break;else _0x35f1c0['push'](_0x35f1c0['shift']());}catch(_0x1038bc){_0x35f1c0['push'](_0x35f1c0['shift']());}}}(a6_0x3b0d,0xc3aba));export const TOOL_NAMES={'EDIT_FILE':a6_0xf86421(0xb3),'CODEBASE_SEARCH':a6_0xf86421(0xb0),'GITHUB_CODEBASE_SEARCH':a6_0xf86421(0xa7)};function a6_0x3b0d(){const _0x1634ad=['45303250fBKDkH','159CtoCeM','66188CWbIGN','121938AzOJSP','values','737148IVnmCO','11895816VXEhWb','3085265KmYIrZ','codebase_search','783139TMygvv','413EBgwts','edit_file','9QtLhBJ','github_codebase_search'];a6_0x3b0d=function(){return _0x1634ad;};return a6_0x3b0d();}export const ALL_TOOL_NAMES=Object[a6_0xf86421(0xac)](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.182",
|
|
4
4
|
"description": "Fast & accurate MCP server with AI-powered file editing and intelligent code search. Prevents context pollution and saves time for a better user experience.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Morph (https://morphllm.com)",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@google/generative-ai": "^0.21.0",
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.12.3",
|
|
38
|
-
"@morphllm/morphsdk": "0.2.
|
|
38
|
+
"@morphllm/morphsdk": "0.2.172",
|
|
39
39
|
"@vscode/ripgrep": "^1.15.14",
|
|
40
40
|
"axios": "^1.6.0",
|
|
41
41
|
"chalk": "^5.3.0",
|