@morphllm/morphmcp 0.8.184 → 0.8.185
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_0x40eb78=a0_0x1a61;(function(_0x1d60cf,_0x22b412){const _0x2cb1ab=a0_0x1a61,_0x4326be=_0x1d60cf();while(!![]){try{const _0x26ca07=parseInt(_0x2cb1ab(0x1b7))/0x1+-parseInt(_0x2cb1ab(0x156))/0x2+-parseInt(_0x2cb1ab(0xee))/0x3+parseInt(_0x2cb1ab(0x131))/0x4+parseInt(_0x2cb1ab(0x1d2))/0x5*(-parseInt(_0x2cb1ab(0x10b))/0x6)+parseInt(_0x2cb1ab(0x18f))/0x7*(parseInt(_0x2cb1ab(0x1d9))/0x8)+parseInt(_0x2cb1ab(0xce))/0x9*(-parseInt(_0x2cb1ab(0x1cf))/0xa);if(_0x26ca07===_0x22b412)break;else _0x4326be['push'](_0x4326be['shift']());}catch(_0x39dd08){_0x4326be['push'](_0x4326be['shift']());}}}(a0_0x3b61,0x22e97));import{Server}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x1a61(_0x1d2a59,_0x47bc1e){_0x1d2a59=_0x1d2a59-0xbe;const _0x3b6171=a0_0x3b61();let _0x1a6124=_0x3b6171[_0x1d2a59];return _0x1a6124;}import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x198608 from'fs/promises';import a0_0x41cd8c from'path';import a0_0x4b32b0 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_0x3c6dee from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x442863){const _0x222dc4=a0_0x1a61,_0x21b46e=_0x442863['split'](a0_0x41cd8c[_0x222dc4(0x1bf)])[_0x222dc4(0x173)](Boolean);if(_0x21b46e[_0x222dc4(0x148)]<0x2)return null;for(let _0x8a8726=Math[_0x222dc4(0x193)](_0x21b46e[_0x222dc4(0x148)]/0x2);_0x8a8726>=0x1;_0x8a8726--){for(let _0x5a77ff=0x0;_0x5a77ff<=_0x21b46e[_0x222dc4(0x148)]-0x2*_0x8a8726;_0x5a77ff++){const _0x58ae5d=_0x21b46e['slice'](_0x5a77ff,_0x5a77ff+_0x8a8726),_0xb27a8a=_0x21b46e[_0x222dc4(0xf6)](_0x5a77ff+_0x8a8726,_0x5a77ff+0x2*_0x8a8726);if(_0x58ae5d[_0x222dc4(0x115)]((_0x4c22f9,_0x2123a3)=>_0x4c22f9===_0xb27a8a[_0x2123a3])){const _0x54f9e3=[..._0x21b46e['slice'](0x0,_0x5a77ff),..._0x21b46e[_0x222dc4(0xf6)](_0x5a77ff+_0x8a8726)];return a0_0x41cd8c['sep']+_0x54f9e3[_0x222dc4(0xe4)](a0_0x41cd8c[_0x222dc4(0x1bf)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x2b82a4=a0_0x1a61;try{const _0x2ab66f=require(_0x2b82a4(0x114));return _0x2ab66f[_0x2b82a4(0x134)]??_0x2b82a4(0x125);}catch(_0x2af014){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x2af014),_0x2b82a4(0x125);}}function printHelp(){const _0x3f8c68=a0_0x1a61;console[_0x3f8c68(0xe0)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x3f8c68(0xe0)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x3f8c68(0xe0)](_0x3f8c68(0x161)),console['log']('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0x3f8c68(0xe0)](_0x3f8c68(0xe6)),console['log']('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x3f8c68(0xe0)]('\x0aExamples:'),console[_0x3f8c68(0xe0)](_0x3f8c68(0x169)),console[_0x3f8c68(0xe0)](_0x3f8c68(0x199));}const cliArgs=process[a0_0x40eb78(0xdd)][a0_0x40eb78(0xf6)](0x2),VERSION_FLAGS=new Set([a0_0x40eb78(0xc2),'-v','-V']),HELP_FLAGS=new Set([a0_0x40eb78(0x1bb),'-h']);cliArgs[a0_0x40eb78(0x1b5)](_0x157e4e=>VERSION_FLAGS[a0_0x40eb78(0xe5)](_0x157e4e))&&(console[a0_0x40eb78(0xe0)](a0_0x40eb78(0x1cc)+getPackageVersion()),process[a0_0x40eb78(0xfe)](0x0));cliArgs['some'](_0x33c525=>HELP_FLAGS[a0_0x40eb78(0xe5)](_0x33c525))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x23bfbc){const _0x47f1de=a0_0x40eb78;for(let _0x2916f2=0x0;_0x2916f2<cliArgs[_0x47f1de(0x148)];_0x2916f2++){const _0x40d10f=cliArgs[_0x2916f2];if(_0x40d10f[_0x47f1de(0xff)]('--'+_0x23bfbc+'='))return _0x40d10f[_0x47f1de(0xf6)](('--'+_0x23bfbc+'=')[_0x47f1de(0x148)]);if(_0x40d10f==='--'+_0x23bfbc&&_0x2916f2+0x1<cliArgs[_0x47f1de(0x148)])return cliArgs[_0x2916f2+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x40eb78(0x148)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x40eb78(0xe5)](arg)||HELP_FLAGS[a0_0x40eb78(0xe5)](arg))continue;if(arg[a0_0x40eb78(0xff)]('--api-key='))continue;if(arg===a0_0x40eb78(0x1a7)){i++;continue;}args[a0_0x40eb78(0xfb)](arg);}const WORKSPACE_ROOT=process['env'][a0_0x40eb78(0x1b0)]||process[a0_0x40eb78(0x183)][a0_0x40eb78(0x126)]||process[a0_0x40eb78(0x177)](),ENABLE_WORKSPACE_MODE=process[a0_0x40eb78(0x183)]['ENABLE_WORKSPACE_MODE']!==a0_0x40eb78(0x132),MORPH_API_KEY=getCliArg(a0_0x40eb78(0x13e))??process[a0_0x40eb78(0x183)]['MORPH_API_KEY'],MORPH_API_URL=process[a0_0x40eb78(0x183)][a0_0x40eb78(0x182)],MORPH_LARGE_APPLY=process[a0_0x40eb78(0x183)][a0_0x40eb78(0x146)]!=='false',MORPH_WARP_GREP_TIMEOUT=process[a0_0x40eb78(0x183)][a0_0x40eb78(0x174)]?parseInt(process[a0_0x40eb78(0x183)][a0_0x40eb78(0x174)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x40eb78(0x183)]['DISABLED_TOOLS']?new Set(process['env'][a0_0x40eb78(0x14a)][a0_0x40eb78(0x1af)](',')[a0_0x40eb78(0x1c4)](_0x22c6a8=>_0x22c6a8['trim']())['filter'](_0x17e983=>_0x17e983[a0_0x40eb78(0x148)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x40eb78(0x1b4)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x40eb78(0x14e)](a0_0x40eb78(0xcd)+tool+a0_0x40eb78(0x10f)+[...KNOWN_TOOL_NAMES][a0_0x40eb78(0xe4)](',\x20'));}console[a0_0x40eb78(0x14e)](a0_0x40eb78(0xf8)+[...DISABLED_TOOLS]['join'](',\x20'));}function a0_0x3b61(){const _0x3e212b=['warp_grep_complete','finish','repo_path','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','\x20disabled\x20via\x20DISABLED_TOOLS','FileNotFound','api-key','\x20valid\x20directories','added\x20','Parent\x20directory\x20does\x20not\x20exist:\x20','FileReadError',',\x20removed\x20','morph-warp-grep-v2.1','catch','MORPH_LARGE_APPLY','edit_file','length','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','DISABLED_TOOLS','inputSchema','grep\x20\x27','terminationReason','error','debug','github_codebase_search','\x20chars)','-\x20Read\x20file\x20`','File\x20read\x20error:','normalize','searchGitHub','125796KmnjRM','Unknown\x20tool:\x20','realpath','ms:','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\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','Warning:\x20Workspace\x20fallback\x20failed:\x20','terminated','Example\x20format:\x0a','assistant','roots','\x0aOptions:','message','composer.json','text','constructor','github_search_start','Morph\x20Edit\x20Preview','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','\x20\x20morph-mcp','file_path','Morph\x20Edit\x20','❌\x20Morph\x20Edit\x20Failed:\x20','morph-v3-fast','content','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.','Rules:\x0a','isArray','instruction','filter','MORPH_WARP_GREP_TIMEOUT','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','runWarpGrep_call','cwd','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','string','compaction_failed','-\x20Grepped\x20\x27','.vscode','linesRemoved','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','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','MORPH_API_URL','env','glob','timeout','changes','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','GitHub\x20search\x20failed:\x20','application/json','arguments','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','LocalRipgrepProvider','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','file_read_failed','20125uFRVcZ','setRequestHandler','substring','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','floor','user','search_type','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','path_validation_failed','toISOString','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','command','Invalid\x20arguments:\x20','Error\x20accessing\x20directory\x20','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','Workspace\x20mode\x20enabled:\x20Using\x20','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','post','\x20(new\x20file)','provider_created','morph-','array','--api-key','owner_repo','lines','BinaryFile','response','<file\x20path=\x22','filePath','API\x20error\x20(auth/rate-limit)','split','WORKSPACE_ROOT','\x20as\x20allowed\x20directory','Unknown\x20error','data','size','some','go.mod','80597GlPAUk','tool_call_received','utf-8','describe','--help','homedir','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.','readFile','sep','UnknownError','metadata','new_string','description','map','Tool\x20\x22','`\x20in\x20`','list_directory','basename','file','tool_calls','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','@morphllm/morphmcp\x20','stat','function','68790sPnTTK','0.2.0','parse','5WArbUS','glob\x20\x27','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','target_filepath','[could\x20not\x20read\x20file:\x20','TimeoutError','number','696IZyMzk','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','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.','tool_call_id','match','timed\x20out','Error:\x20','messages','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','access','Fallback:\x20Using\x20workspace\x20root\x20','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','Created\x20File','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.','.\x20Changes:\x20','instructions','\x0a</file>','now','EDIT_FILE','.git','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','target_file','branch','grep','--version','codebase_search','MCP','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','etimedout','RipgrepNotAvailable','source','node_modules','WarpGrepError','linesAdded','requiresApiKey','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','144FgaqbT','Tool\x20','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','\x20error(s)','\x22>\x0aError\x20reading\x20file:\x20','role','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','path','list_directory\x20','ENOENT','search_string','code','-\x20Glob\x20search\x20`','isDirectory','argv','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','grep_search','log','Parameters:\x0a','errors','SubToolError','join','has','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','completed_with_file_errors','read','safeParse','enum','CODEBASE_SEARCH','SymlinkError','includes','423810RxIJmG','listRoots','optional','https://morphllm.com/api/error-report','object','Cargo.toml','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','\x0a...\x20(truncated,\x20total:\x20','slice','code_edit','Disabled\x20tools:\x20','success','files','push','pattern','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.','exit','startsWith','dirname','WarpGrep\x20sub-tool\x20errors:\x20','github_url','oninitialized','completed','tool_call_complete','Bearer\x20','Fatal\x20error\x20running\x20server:','Error\x20running\x20fast\x20context\x20search:\x20','mcp-filesystem','stack','130254dfScOn','tsconfig.json','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','\x22.\x20Known\x20tools:\x20','toLowerCase','\x20is\x20not\x20a\x20directory','path_validation_resolved','name','../package.json','every','file_read_complete','resolve','.cursor','status','default',',\x20modified\x20','ReadError','RipgrepError','completionId','Failed\x20to\x20read\x20file:\x20','dryRun','path_validation_start','tool_call_error','warn','timings','unknown','PWD','Here\x20is\x20the\x20content\x20of\x20files:\x0a','package.json','GITHUB_CODEBASE_SEARCH','Warning:\x20','params','\x22>\x0a','ToolException','\x20-\x20','.\x20Path:\x20','Repository\x20identifier','592872usHJcC','false','indexOf','version','all','linesModified','payload'];a0_0x3b61=function(){return _0x3e212b;};return a0_0x3b61();}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x40eb78(0xff)]('sk-')&&!MORPH_API_KEY[a0_0x40eb78(0xff)](a0_0x40eb78(0x1a5))&&logMcpStderr(a0_0x40eb78(0x180));async function reportMorphError(_0x5b0853){const _0x395bbc=a0_0x40eb78;try{await a0_0x3c6dee[_0x395bbc(0x1a2)](_0x395bbc(0xf1),{..._0x5b0853,'timestamp':new Date()[_0x395bbc(0x198)](),'source':_0x5b0853[_0x395bbc(0xc8)]||_0x395bbc(0x109),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x5b0853['context']}},{'timeout':0x1388,'headers':{'Content-Type':_0x395bbc(0x189),'Authorization':_0x395bbc(0x106)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x30d3fa,_0x54405d){const _0x4e1908=a0_0x40eb78;if(_0x30d3fa&&typeof _0x30d3fa==='object'&&'status'in _0x30d3fa)return _0x30d3fa[_0x4e1908(0x119)];if(_0x30d3fa&&typeof _0x30d3fa==='object'&&'response'in _0x30d3fa)return _0x30d3fa[_0x4e1908(0x1ab)]?.['status'];const _0x52fcd1=_0x54405d['match'](/\b(401|429)\b/);return _0x52fcd1?parseInt(_0x52fcd1[0x1],0xa):null;}function handleMorphAPIError(_0x5bb34c){const _0x593fc7=a0_0x40eb78,_0x156cb8=_0x5bb34c instanceof Error?_0x5bb34c['message']:String(_0x5bb34c),_0x441f79=extractStatusCode(_0x5bb34c,_0x156cb8);switch(_0x441f79){case 0x191:return{'content':[{'type':_0x593fc7(0x164),'text':_0x593fc7(0x1e6)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x593fc7(0x164),'text':'Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.'}],'isError':!![]};default:return null;}}args[a0_0x40eb78(0x148)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x40eb78(0xc5)),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr(a0_0x40eb78(0x179)),logMcpStderr(a0_0x40eb78(0x1da)),logMcpStderr(a0_0x40eb78(0x178)),logMcpStderr(a0_0x40eb78(0x1e4)));function normalizePath(_0x53fb89){const _0x142533=a0_0x40eb78;return a0_0x41cd8c[_0x142533(0x154)](_0x53fb89);}function expandHome(_0x59b5f8){const _0x41521e=a0_0x40eb78;if(_0x59b5f8['startsWith']('~/')||_0x59b5f8==='~')return a0_0x41cd8c[_0x41521e(0xe4)](a0_0x4b32b0[_0x41521e(0x1bc)](),_0x59b5f8[_0x41521e(0xf6)](0x1));return _0x59b5f8;}let allowedDirectories=await Promise[a0_0x40eb78(0x135)](args['map'](async _0x2eb477=>{const _0x1a5518=a0_0x40eb78,_0x46cca=expandHome(_0x2eb477),_0x27829b=a0_0x41cd8c[_0x1a5518(0x117)](_0x46cca);try{const _0x4dd584=await a0_0x198608[_0x1a5518(0x158)](_0x27829b);return normalizePath(_0x4dd584);}catch(_0x1da7ce){return normalizePath(_0x27829b);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x40eb78(0x148)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x40eb78(0xfb)](workspaceDir),logMcpStderr(a0_0x40eb78(0x1a0)+workspaceDir+a0_0x40eb78(0x1b1)));}catch(a0_0x1431c5){logMcpStderr(a0_0x40eb78(0x15a)+a0_0x1431c5);}async function detectWorkspaceRoot(_0x46fe36){const _0x25657e=a0_0x40eb78;let _0x382fcb=a0_0x41cd8c[_0x25657e(0x117)](_0x46fe36);const _0x31f53d=[_0x25657e(0x1ec),_0x25657e(0x17d),_0x25657e(0x128),_0x25657e(0xf3),'pyproject.toml',_0x25657e(0x1b6),_0x25657e(0x118),_0x25657e(0x10c),_0x25657e(0x163)];while(_0x382fcb!==a0_0x41cd8c[_0x25657e(0x100)](_0x382fcb)){for(const _0x44b50f of _0x31f53d){const _0x5ab363=a0_0x41cd8c[_0x25657e(0xe4)](_0x382fcb,_0x44b50f);try{return await a0_0x198608[_0x25657e(0x1e2)](_0x5ab363),normalizePath(_0x382fcb);}catch{}}_0x382fcb=a0_0x41cd8c[_0x25657e(0x100)](_0x382fcb);}return normalizePath(_0x46fe36);}await Promise[a0_0x40eb78(0x135)](args[a0_0x40eb78(0x1c4)](async _0x8ca957=>{const _0x30aeee=a0_0x40eb78;try{const _0x581547=await a0_0x198608[_0x30aeee(0x1cd)](expandHome(_0x8ca957));!_0x581547[_0x30aeee(0xdc)]()&&(logMcpStderr('Error:\x20'+_0x8ca957+_0x30aeee(0x111)),process['exit'](0x1));}catch(_0x29cca0){logMcpStderr(_0x30aeee(0x19c)+_0x8ca957+':',_0x29cca0),process[_0x30aeee(0xfe)](0x1);}}));async function validatePath(_0x298936){const _0x1c0518=a0_0x40eb78,_0x49829b=expandHome(_0x298936),_0x6b13f1=a0_0x41cd8c[_0x1c0518(0x117)](_0x49829b);logger[_0x1c0518(0x14f)](_0x1c0518(0xc4),_0x1c0518(0x121),{'raw_path':_0x298936,'absolute':_0x6b13f1});try{const _0x4289c5=await a0_0x198608[_0x1c0518(0x158)](_0x6b13f1);return logger[_0x1c0518(0x14f)](_0x1c0518(0xc4),'path_validation_resolved',{'resolved':_0x4289c5,'symlink':_0x4289c5!==_0x6b13f1}),_0x4289c5;}catch(_0x457dfb){if(_0x457dfb[_0x1c0518(0xda)]===_0x1c0518(0xd8)){const _0x1aa68c=a0_0x41cd8c[_0x1c0518(0x100)](_0x6b13f1);try{const _0x1dcf3d=await a0_0x198608['realpath'](_0x1aa68c),_0x53762a=a0_0x41cd8c[_0x1c0518(0xe4)](_0x1dcf3d,a0_0x41cd8c[_0x1c0518(0x1c8)](_0x6b13f1));return logger[_0x1c0518(0x14f)]('MCP',_0x1c0518(0x112),{'resolved':_0x53762a,'new_file':!![]}),_0x53762a;}catch{logger[_0x1c0518(0x14e)]('MCP',_0x1c0518(0x197),{'raw_path':_0x298936,'error':_0x1c0518(0x141)+_0x1aa68c});throw new Error(_0x1c0518(0x141)+_0x1aa68c);}}logger[_0x1c0518(0x14e)](_0x1c0518(0xc4),_0x1c0518(0x197),{'raw_path':_0x298936,'error':_0x457dfb[_0x1c0518(0x162)]});throw _0x457dfb;}}const MorphEditFileArgsSchema=z[a0_0x40eb78(0xf2)]({'path':z['string'](),'code_edit':z[a0_0x40eb78(0x17a)]()[a0_0x40eb78(0x1ba)](a0_0x40eb78(0x187)),'instruction':z[a0_0x40eb78(0x17a)]()[a0_0x40eb78(0x1ba)](a0_0x40eb78(0xd5)),'dryRun':z['boolean']()[a0_0x40eb78(0x11a)](![])[a0_0x40eb78(0x1ba)]('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x40eb78(0xfd),WarpGrepArgsSchema=z[a0_0x40eb78(0xf2)]({'search_string':z[a0_0x40eb78(0x17a)]()[a0_0x40eb78(0x1ba)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()[a0_0x40eb78(0x1ba)](a0_0x40eb78(0x15b)),'search_type':z[a0_0x40eb78(0xea)]([a0_0x40eb78(0x11a),a0_0x40eb78(0xc9)])['optional']()[a0_0x40eb78(0x1ba)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z[a0_0x40eb78(0xf2)]({'search_string':z[a0_0x40eb78(0x17a)]()[a0_0x40eb78(0x1ba)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x40eb78(0x17a)]()['optional']()[a0_0x40eb78(0x1ba)](a0_0x40eb78(0x1db)),'owner_repo':z[a0_0x40eb78(0x17a)]()['optional']()[a0_0x40eb78(0x1ba)](a0_0x40eb78(0x17f)),'branch':z[a0_0x40eb78(0x17a)]()[a0_0x40eb78(0xf0)]()[a0_0x40eb78(0x1ba)](a0_0x40eb78(0xde))}),CodebaseSearchArgsSchema=z[a0_0x40eb78(0xf2)]({'query':z['string']()[a0_0x40eb78(0x1ba)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x40eb78(0x17a)]()[a0_0x40eb78(0x1ba)](a0_0x40eb78(0x130)),'branch':z['string']()['optional']()[a0_0x40eb78(0x1ba)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z['string']()[a0_0x40eb78(0xf0)]()[a0_0x40eb78(0x1ba)]('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z[a0_0x40eb78(0x1a6)](z[a0_0x40eb78(0x17a)]())[a0_0x40eb78(0x11a)]([])['describe'](a0_0x40eb78(0xd0)),'limit':z[a0_0x40eb78(0x1d8)]()['optional']()[a0_0x40eb78(0x11a)](0xa)[a0_0x40eb78(0x1ba)]('Max\x20results\x20to\x20return')}),server=new Server({'name':'morph-mcp','version':a0_0x40eb78(0x1d0)},{'capabilities':{'tools':{}}});server[a0_0x40eb78(0x190)](ListToolsRequestSchema,async()=>{const _0x45e7fb=a0_0x40eb78,_0x1b7e58=[{'name':TOOL_NAMES['EDIT_FILE'],'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a'+_0x45e7fb(0xe1)+_0x45e7fb(0x175)+_0x45e7fb(0x18b)+_0x45e7fb(0x19d)+_0x45e7fb(0x181)+_0x45e7fb(0x15e)+_0x45e7fb(0x18d)+_0x45e7fb(0x170)+_0x45e7fb(0xf4)+'-\x20Preserve\x20exact\x20indentation\x0a'+'-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a'+_0x45e7fb(0x19e),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x45e7fb(0xeb)],'description':_0x45e7fb(0x149)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x45e7fb(0x168)+_0x45e7fb(0x1cb)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x57d626=_0x1b7e58['filter'](_0x130cbd=>{const _0x280f7b=_0x45e7fb;if(DISABLED_TOOLS[_0x280f7b(0xe5)](_0x130cbd[_0x280f7b(0x113)]))return console['error'](_0x280f7b(0xcf)+_0x130cbd[_0x280f7b(0x113)]+_0x280f7b(0x13c)),![];if(_0x280f7b(0xcc)in _0x130cbd&&_0x130cbd[_0x280f7b(0xcc)]&&!MORPH_API_KEY)return logMcpStderr(_0x280f7b(0x12a)+_0x130cbd[_0x280f7b(0x113)]+_0x280f7b(0x192)),![];return!![];});return{'tools':_0x57d626[_0x45e7fb(0x1c4)](_0x295ee3=>({'name':_0x295ee3['name'],'description':_0x295ee3[_0x45e7fb(0x1c3)],'inputSchema':_0x295ee3[_0x45e7fb(0x14b)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x14fb5c=>{const _0x31a3bd=a0_0x40eb78,{name:_0x2061d5,arguments:_0x59abb9}=_0x14fb5c[_0x31a3bd(0x12b)],_0x3cf95c=Date['now']();logger[_0x31a3bd(0x14f)](_0x31a3bd(0xc4),_0x31a3bd(0x1b8),{'tool':_0x2061d5,'args':_0x2061d5==='edit_file'?{'path':_0x59abb9?.[_0x31a3bd(0xd6)],'instruction':_0x59abb9?.[_0x31a3bd(0x172)]||_0x59abb9?.[_0x31a3bd(0x1e8)],'dryRun':_0x59abb9?.[_0x31a3bd(0x120)]}:_0x59abb9});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x31a3bd(0x164),'text':'No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.'}],'isError':!![]};if(!MORPH_API_KEY[_0x31a3bd(0xff)]('sk-')&&!MORPH_API_KEY[_0x31a3bd(0xff)](_0x31a3bd(0x1a5)))return{'content':[{'type':'text','text':_0x31a3bd(0x16f)}],'isError':!![]};if(DISABLED_TOOLS[_0x31a3bd(0xe5)](_0x2061d5))return{'content':[{'type':_0x31a3bd(0x164),'text':_0x31a3bd(0x1c5)+_0x2061d5+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x2061d5){case TOOL_NAMES[_0x31a3bd(0x1eb)]:{let _0x216beb=_0x59abb9;if(_0x216beb&&typeof _0x216beb===_0x31a3bd(0xf2)){if(!(_0x31a3bd(0xd6)in _0x216beb)){const _0x45a0aa=_0x216beb[_0x31a3bd(0xbf)]??_0x216beb[_0x31a3bd(0x1ad)]??_0x216beb[_0x31a3bd(0x1d5)]??_0x216beb[_0x31a3bd(0x16a)]??_0x216beb[_0x31a3bd(0x1c9)];if(_0x45a0aa)_0x216beb={..._0x216beb,'path':_0x45a0aa};}_0x31a3bd(0x1e8)in _0x216beb&&!(_0x31a3bd(0x172)in _0x216beb)&&(_0x216beb={..._0x216beb,'instruction':_0x216beb[_0x31a3bd(0x1e8)]});if(!('code_edit'in _0x216beb)){const _0x729abc=_0x216beb[_0x31a3bd(0xda)]??_0x216beb[_0x31a3bd(0x1c2)]??_0x216beb[_0x31a3bd(0x16e)]??_0x216beb['edit'];if(_0x729abc)_0x216beb={..._0x216beb,'code_edit':_0x729abc};}}const _0x1518ef=MorphEditFileArgsSchema[_0x31a3bd(0xe9)](_0x216beb);if(!_0x1518ef['success'])throw new Error(_0x31a3bd(0x196)+_0x1518ef[_0x31a3bd(0x14e)]);const _0x58ce77=await validatePath(_0x1518ef[_0x31a3bd(0x1b3)]['path']);let _0x1be44e=null,_0x5172cf=!![],_0x3baea4=null;try{_0x1be44e=await a0_0x198608[_0x31a3bd(0x1be)](_0x58ce77,_0x31a3bd(0x1b9)),logger['debug'](_0x31a3bd(0xc4),_0x31a3bd(0x116),{'path':_0x58ce77,'size_bytes':_0x1be44e[_0x31a3bd(0x148)]});}catch(_0x2130df){const _0x516d8a=_0x2130df['code'];_0x516d8a===_0x31a3bd(0xd8)?(_0x5172cf=![],_0x1be44e='',logger[_0x31a3bd(0x14f)]('MCP',_0x31a3bd(0x116),{'path':_0x58ce77,'exists':![]})):(_0x3baea4=_0x31a3bd(0x11f)+(_0x516d8a||'unknown')+_0x31a3bd(0x12e)+(_0x2130df instanceof Error?_0x2130df[_0x31a3bd(0x162)]:String(_0x2130df)),logger[_0x31a3bd(0x14e)]('MCP',_0x31a3bd(0x18e),{'path':_0x58ce77,'error':_0x3baea4}),logMcpStderr(_0x31a3bd(0x12a)+_0x3baea4));}let _0x40e544;try{const _0x6f918d=MORPH_API_KEY;if(!_0x6f918d)throw new Error(_0x31a3bd(0xbe));const _0x5a2c1e=a0_0x41cd8c['dirname'](_0x58ce77),_0x68c565=a0_0x41cd8c[_0x31a3bd(0x1c8)](_0x58ce77);logger[_0x31a3bd(0x14f)](_0x31a3bd(0xc4),'api_request_start',{'model':_0x31a3bd(0x16d),'path':_0x1518ef[_0x31a3bd(0x1b3)][_0x31a3bd(0xd6)],'instruction_len':_0x1518ef[_0x31a3bd(0x1b3)][_0x31a3bd(0x172)]['length'],'code_edit_len':_0x1518ef[_0x31a3bd(0x1b3)][_0x31a3bd(0xf7)][_0x31a3bd(0x148)],'original_code_len':_0x1be44e?.[_0x31a3bd(0x148)]??0x0,'dry_run':_0x1518ef[_0x31a3bd(0x1b3)]['dryRun']});const _0x37a49c=Date[_0x31a3bd(0x1ea)](),_0x55f78a=await executeEditFile({'target_filepath':_0x68c565,'code_edit':_0x1518ef['data'][_0x31a3bd(0xf7)],'instruction':_0x1518ef[_0x31a3bd(0x1b3)][_0x31a3bd(0x172)]},{'morphApiKey':_0x6f918d,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x5a2c1e,'autoWrite':!_0x1518ef['data'][_0x31a3bd(0x120)],'generateUdiff':![],'debug':![]}),_0x165d9f=Date['now']()-_0x37a49c;_0x40e544=_0x55f78a[_0x31a3bd(0x11e)];if(!_0x55f78a[_0x31a3bd(0xf9)])throw new Error(_0x55f78a[_0x31a3bd(0x14e)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x11458b=_0x55f78a[_0x31a3bd(0x186)],_0x497ee3=_0x31a3bd(0x140)+_0x11458b['linesAdded']+_0x31a3bd(0x143)+_0x11458b[_0x31a3bd(0x17e)]+_0x31a3bd(0x11b)+_0x11458b[_0x31a3bd(0x136)];logger[_0x31a3bd(0x14f)](_0x31a3bd(0xc4),_0x31a3bd(0x105),{'tool':_0x31a3bd(0x147),'success':!![],'latency_ms':Date['now']()-_0x3cf95c,'edit_latency_ms':_0x165d9f,'changes':{'added':_0x11458b[_0x31a3bd(0xcb)],'removed':_0x11458b[_0x31a3bd(0x17e)],'modified':_0x11458b['linesModified']},'completion_id':_0x40e544});if(_0x1518ef['data'][_0x31a3bd(0x120)])return{'content':[{'type':_0x31a3bd(0x164),'text':_0x31a3bd(0x167)+(_0x5172cf?'':_0x31a3bd(0x1a3))+':\x20'+_0x1518ef[_0x31a3bd(0x1b3)][_0x31a3bd(0x172)]+_0x31a3bd(0x1e7)+_0x497ee3+_0x31a3bd(0x12f)+_0x1518ef[_0x31a3bd(0x1b3)][_0x31a3bd(0xd6)]+'.'}]};return{'content':[{'type':_0x31a3bd(0x164),'text':_0x31a3bd(0x16b)+(_0x5172cf?'Applied':_0x31a3bd(0x1e5))+':\x20'+_0x1518ef[_0x31a3bd(0x1b3)]['instruction']+_0x31a3bd(0x1e7)+_0x497ee3+_0x31a3bd(0x12f)+_0x1518ef[_0x31a3bd(0x1b3)][_0x31a3bd(0xd6)]+'.'}]};}catch(_0x5429fa){const _0x3b0e25=handleMorphAPIError(_0x5429fa);if(_0x3b0e25)return logger[_0x31a3bd(0x14e)]('MCP','tool_call_error',{'tool':'edit_file','error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x31a3bd(0x1ea)]()-_0x3cf95c}),_0x3b0e25;const _0x20656a=_0x5429fa instanceof Error?_0x5429fa[_0x31a3bd(0x162)]:String(_0x5429fa);return logger[_0x31a3bd(0x14e)](_0x31a3bd(0xc4),'tool_call_error',{'tool':'edit_file','error':_0x20656a,'path':_0x1518ef[_0x31a3bd(0x1b3)][_0x31a3bd(0xd6)],'validated_path':_0x58ce77,'latency_ms':Date[_0x31a3bd(0x1ea)]()-_0x3cf95c,'stack':_0x5429fa instanceof Error?_0x5429fa[_0x31a3bd(0x10a)]:undefined}),reportMorphError({'error_message':_0x20656a,'error_type':_0x5429fa instanceof Error?_0x5429fa[_0x31a3bd(0x165)]['name']:_0x31a3bd(0x1c0),'context':{'tool':_0x31a3bd(0x147),'completion_id':_0x40e544,'file_path':_0x1518ef[_0x31a3bd(0x1b3)][_0x31a3bd(0xd6)],'validated_path':_0x58ce77,'instruction':_0x1518ef[_0x31a3bd(0x1b3)][_0x31a3bd(0x172)],'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x31a3bd(0x16d),'dry_run':_0x1518ef[_0x31a3bd(0x1b3)][_0x31a3bd(0x120)],'file_exists':_0x5172cf,'file_read_error':_0x3baea4,'file_readable':_0x1be44e!==null,'request_content':{'path':_0x1518ef[_0x31a3bd(0x1b3)][_0x31a3bd(0xd6)],'code_edit':_0x1518ef['data'][_0x31a3bd(0xf7)],'instruction':_0x1518ef[_0x31a3bd(0x1b3)]['instruction'],'original_code':_0x1be44e!==null?_0x1be44e[_0x31a3bd(0x148)]>0xc350?_0x1be44e['substring'](0x0,0xc350)+_0x31a3bd(0xf5)+_0x1be44e[_0x31a3bd(0x148)]+_0x31a3bd(0x151):_0x1be44e:_0x31a3bd(0x1d6)+(_0x3baea4||'unknown\x20error')+']','original_code_length':_0x1be44e?.[_0x31a3bd(0x148)]??0x0,'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x31a3bd(0x16d),'dry_run':_0x1518ef[_0x31a3bd(0x1b3)][_0x31a3bd(0x120)]}},'stack_trace':_0x5429fa instanceof Error?_0x5429fa[_0x31a3bd(0x10a)]:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':_0x31a3bd(0x164),'text':_0x31a3bd(0x16c)+_0x20656a}],'isError':!![]};}}case TOOL_NAMES[_0x31a3bd(0xeb)]:{const _0x351f2f=WarpGrepArgsSchema[_0x31a3bd(0xe9)](_0x59abb9);if(!_0x351f2f[_0x31a3bd(0xf9)])return{'content':[{'type':_0x31a3bd(0x164),'text':_0x31a3bd(0x19b)+_0x351f2f['error']}],'isError':!![]};const _0x4d1d6f=_0x35a321=>{const _0x54804c=_0x31a3bd,_0x43624d=[];for(const _0x50c48a of _0x35a321||[]){if(_0x50c48a[_0x54804c(0xd3)]===_0x54804c(0x15f)&&Array['isArray'](_0x50c48a[_0x54804c(0x1ca)]))for(const _0x48826c of _0x50c48a[_0x54804c(0x1ca)]){try{const _0x3abcab=_0x48826c['function']?.[_0x54804c(0x113)],_0x29fb0b=JSON[_0x54804c(0x1d1)](_0x48826c[_0x54804c(0x1ce)]?.[_0x54804c(0x18a)]||'{}');if(_0x3abcab===_0x54804c(0xdf))_0x43624d[_0x54804c(0xfb)](_0x54804c(0x14c)+_0x29fb0b[_0x54804c(0xfc)]+'\x27\x20'+(_0x29fb0b[_0x54804c(0xd6)]||'.'));else{if(_0x3abcab==='read')_0x43624d[_0x54804c(0xfb)]('read\x20'+_0x29fb0b[_0x54804c(0xd6)]);else{if(_0x3abcab===_0x54804c(0x1c7))_0x43624d[_0x54804c(0xfb)](_0x54804c(0xd7)+(_0x29fb0b['command']||'.'));else{if(_0x3abcab===_0x54804c(0x184))_0x43624d[_0x54804c(0xfb)](_0x54804c(0x1d3)+_0x29fb0b[_0x54804c(0xfc)]+'\x27\x20'+(_0x29fb0b[_0x54804c(0xd6)]||'.'));else _0x3abcab===_0x54804c(0x139)&&_0x43624d['push']('finish');}}}}catch{}}}return _0x43624d;},_0x3cc303=_0xeb47d3=>{const _0x1c9bda=_0x31a3bd,_0x526027=[];if(!_0xeb47d3||!Array[_0x1c9bda(0x171)](_0xeb47d3))return _0x526027;const _0x4a184c=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x1c9bda(0x13d),'tool':_0x1c9bda(0xe8)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x1c9bda(0xe8)},{'pattern':/\[READ ERROR\]/,'error_type':_0x1c9bda(0x11c),'tool':_0x1c9bda(0xe8)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x1c9bda(0x1aa),'tool':_0x1c9bda(0xe8)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x1c9bda(0x11d),'tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x1c9bda(0xc7),'tool':_0x1c9bda(0xc1)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x1c9bda(0x1aa),'tool':_0x1c9bda(0xe8)},{'pattern':/\[SYMLINK\]/,'error_type':_0x1c9bda(0xec),'tool':'read'},{'pattern':/not a text file/,'error_type':_0x1c9bda(0x1aa),'tool':_0x1c9bda(0xe8)},{'pattern':/symbolic link/,'error_type':_0x1c9bda(0xec),'tool':_0x1c9bda(0xe8)},{'pattern':/Error reading file:/,'error_type':_0x1c9bda(0x11c),'tool':_0x1c9bda(0xe8)},{'pattern':/status="error"/,'error_type':_0x1c9bda(0x12d),'tool':_0x1c9bda(0x125)}];let _0x1c7060=0x0;for(const _0x2fdc88 of _0xeb47d3){_0x2fdc88[_0x1c9bda(0xd3)]==='assistant'&&Array[_0x1c9bda(0x171)](_0x2fdc88[_0x1c9bda(0x1ca)])&&_0x1c7060++;const _0x1e6563=_0x2fdc88[_0x1c9bda(0x16e)];if((_0x2fdc88[_0x1c9bda(0xd3)]==='tool'||_0x2fdc88[_0x1c9bda(0xd3)]===_0x1c9bda(0x194))&&_0x1e6563&&typeof _0x1e6563===_0x1c9bda(0x17a))for(const {pattern:_0xe1dccc,error_type:_0x436bd6,tool:_0x244342}of _0x4a184c){const _0x3a4535=_0x1e6563[_0x1c9bda(0x1dd)](new RegExp(_0xe1dccc[_0x1c9bda(0xc8)],'g'));if(_0x3a4535)for(const _0x4bfad1 of _0x3a4535){const _0x24edf9=_0x1e6563[_0x1c9bda(0x133)](_0x4bfad1),_0x25f1ed=_0x1e6563['substring'](_0x24edf9,Math['min'](_0x24edf9+0xc8,_0x1e6563[_0x1c9bda(0x148)]));_0x526027['push']({'tool':_0x244342,'error_type':_0x436bd6,'error_message':_0x25f1ed['split']('\x0a')[0x0],'turn':_0x1c7060});}}}return _0x526027;};try{const _0xd1b741=a0_0x41cd8c[_0x31a3bd(0x117)](_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0x13a)]),_0x32605d=_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0x195)],_0x4ffd4e=_0x32605d===_0x31a3bd(0xc9)?{'allowNames':[_0x31a3bd(0xc9)]}:undefined,_0x15dcc6=new LocalRipgrepProvider(_0xd1b741,undefined,_0x4ffd4e);logger[_0x31a3bd(0x14f)]('MCP',_0x31a3bd(0x1a4),{'type':_0x31a3bd(0x18c),'repo_root':_0xd1b741,'search_type':_0x32605d||'default'}),logger[_0x31a3bd(0x14f)]('MCP','warp_grep_start',{'query':_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0xd9)],'repo_root':_0xd1b741,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x342f13=Date[_0x31a3bd(0x1ea)](),_0x3896c9=await runWarpGrep({'searchTerm':_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0xd9)],'repoRoot':_0xd1b741,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x15dcc6,'search_type':_0x32605d}),_0x397a82=Date[_0x31a3bd(0x1ea)]()-_0x342f13,_0x3f1938=_0x3896c9[_0x31a3bd(0x139)]?.[_0x31a3bd(0x1c1)]?.[_0x31a3bd(0xfa)]?.['length']??0x0;logger[_0x31a3bd(0x14f)]('MCP',_0x31a3bd(0x138),{'termination':_0x3896c9[_0x31a3bd(0x14d)],'turns':_0x3896c9['timings']?.['turns']??0x0,'files_found':_0x3f1938,'latency_ms':_0x397a82});const _0x27bac9=_0x3cc303(_0x3896c9[_0x31a3bd(0x1e0)]);_0x27bac9[_0x31a3bd(0x148)]>0x0&&reportMorphError({'error_message':_0x31a3bd(0x101)+_0x27bac9[_0x31a3bd(0x148)]+_0x31a3bd(0xd1),'error_type':_0x31a3bd(0xe3),'level':_0x31a3bd(0x123),'tool':_0x31a3bd(0xc3),'context':{'repo_path':_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0x13a)],'query':_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0xd9)],'model':'morph-warp-grep-v2.1','termination_reason':_0x3896c9['terminationReason'],'sub_tool_errors':_0x27bac9,'timings':_0x3896c9[_0x31a3bd(0x124)],'tool_calls':_0x4d1d6f(_0x3896c9[_0x31a3bd(0x1e0)]),'messages':_0x3896c9[_0x31a3bd(0x1e0)]?.['map'](_0x1969ca=>({'role':_0x1969ca[_0x31a3bd(0xd3)],'content':_0x1969ca[_0x31a3bd(0x16e)],..._0x1969ca[_0x31a3bd(0x1ca)]?{'tool_calls':_0x1969ca[_0x31a3bd(0x1ca)][_0x31a3bd(0x148)]}:{},..._0x1969ca[_0x31a3bd(0x1dc)]?{'tool_call_id':_0x1969ca[_0x31a3bd(0x1dc)]}:{}}))},'source':_0x31a3bd(0x109)})['catch'](()=>{});let _0x4037bc='';if(_0x3896c9['terminationReason']===_0x31a3bd(0x104)&&_0x3896c9['finish']?.[_0x31a3bd(0x1c1)]?.[_0x31a3bd(0xfa)]){const _0x5b2085=_0x3896c9[_0x31a3bd(0x139)][_0x31a3bd(0x1c1)][_0x31a3bd(0xfa)];if(_0x5b2085[_0x31a3bd(0x148)]===0x0)return _0x4037bc=_0x3896c9[_0x31a3bd(0x139)][_0x31a3bd(0x137)]||_0x31a3bd(0xd4),{'content':[{'type':_0x31a3bd(0x164),'text':_0x4037bc}]};const _0x3012d7=[],_0x1b3835=[_0x31a3bd(0x1d4)];for(const _0x11f62b of _0x3896c9[_0x31a3bd(0x1e0)]){if(_0x11f62b[_0x31a3bd(0xd3)]===_0x31a3bd(0x15f)&&Array[_0x31a3bd(0x171)](_0x11f62b[_0x31a3bd(0x1ca)]))for(const _0x38c7dc of _0x11f62b['tool_calls']){try{const _0x313c7f=_0x38c7dc['function']?.[_0x31a3bd(0x113)],_0x564284=JSON[_0x31a3bd(0x1d1)](_0x38c7dc[_0x31a3bd(0x1ce)]?.[_0x31a3bd(0x18a)]||'{}');if(_0x313c7f===_0x31a3bd(0xdf))_0x1b3835[_0x31a3bd(0xfb)](_0x31a3bd(0x17c)+_0x564284[_0x31a3bd(0xfc)]+'\x27\x20in\x20`'+(_0x564284[_0x31a3bd(0xd6)]||'.')+'`');else{if(_0x313c7f===_0x31a3bd(0xe8))_0x1b3835[_0x31a3bd(0xfb)](_0x31a3bd(0x152)+_0x564284[_0x31a3bd(0xd6)]+'`');else{if(_0x313c7f==='list_directory')_0x1b3835['push']('-\x20Listed\x20directory\x20`'+(_0x564284[_0x31a3bd(0x19a)]||'.')+'`');else _0x313c7f===_0x31a3bd(0x184)&&_0x1b3835[_0x31a3bd(0xfb)](_0x31a3bd(0xdb)+_0x564284[_0x31a3bd(0xfc)]+_0x31a3bd(0x1c6)+(_0x564284['path']||'.')+'`');}}}catch{}}}_0x3012d7['push'](_0x1b3835[_0x31a3bd(0xe4)]('\x0a'));const _0x17b8cc=['','Relevant\x20context\x20found:'];for(const _0x3a2262 of _0x5b2085){if(_0x3a2262['lines']==='*')_0x17b8cc[_0x31a3bd(0xfb)]('-\x20'+_0x3a2262['path']+':*');else{if(Array[_0x31a3bd(0x171)](_0x3a2262[_0x31a3bd(0x1a9)])){const _0x9f6b89=_0x3a2262[_0x31a3bd(0x1a9)][_0x31a3bd(0x1c4)](([_0x51e895,_0x5464a1])=>{if(_0x51e895===_0x5464a1)return''+_0x51e895;return _0x51e895+'-'+_0x5464a1;});_0x17b8cc[_0x31a3bd(0xfb)]('-\x20'+_0x3a2262[_0x31a3bd(0xd6)]+':'+_0x9f6b89[_0x31a3bd(0xe4)](','));}else _0x17b8cc[_0x31a3bd(0xfb)]('-\x20'+_0x3a2262[_0x31a3bd(0xd6)]+':*');}}_0x17b8cc[_0x31a3bd(0xfb)](''),_0x3012d7[_0x31a3bd(0xfb)](_0x17b8cc['join']('\x0a')),_0x3012d7['push'](_0x31a3bd(0x127));const _0xf1a98c=[],_0x528b0a=[];for(const _0x25f5a9 of _0x5b2085){let _0x560cbf=a0_0x41cd8c[_0x31a3bd(0x117)](_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0x13a)],_0x25f5a9[_0x31a3bd(0xd6)]),_0x2ada8c=null,_0x48a037=null;try{_0x2ada8c=await a0_0x198608['readFile'](_0x560cbf,{'encoding':_0x31a3bd(0x1b9)});}catch(_0x580044){const _0x33cd3=fixPathRepetition(_0x560cbf);if(_0x33cd3)try{_0x2ada8c=await a0_0x198608['readFile'](_0x33cd3,{'encoding':_0x31a3bd(0x1b9)}),_0x560cbf=_0x33cd3;}catch{_0x48a037=_0x580044 instanceof Error?_0x580044:new Error(String(_0x580044));}else _0x48a037=_0x580044 instanceof Error?_0x580044:new Error(String(_0x580044));}if(_0x2ada8c!==null){const _0x20d295=_0x2ada8c['split'](/\r?\n/),_0x66bbfd=[];if(_0x25f5a9['lines']==='*'||!Array[_0x31a3bd(0x171)](_0x25f5a9[_0x31a3bd(0x1a9)]))for(let _0x226f35=0x1;_0x226f35<=_0x20d295[_0x31a3bd(0x148)];_0x226f35++){const _0x453e8c=_0x20d295[_0x226f35-0x1];_0x66bbfd[_0x31a3bd(0xfb)](_0x226f35+'|\x20'+_0x453e8c);}else for(const [_0x413547,_0x5c2e09]of _0x25f5a9['lines']){_0x66bbfd[_0x31a3bd(0x148)]>0x0&&_0x66bbfd[_0x31a3bd(0xfb)]('');for(let _0x5ac1dd=_0x413547;_0x5ac1dd<=_0x5c2e09&&_0x5ac1dd<=_0x20d295[_0x31a3bd(0x148)];_0x5ac1dd++){const _0x3b1410=_0x20d295[_0x5ac1dd-0x1];_0x66bbfd['push'](_0x5ac1dd+'|\x20'+_0x3b1410);}}_0x528b0a[_0x31a3bd(0xfb)]({'path':_0x25f5a9[_0x31a3bd(0xd6)],'content':_0x66bbfd['join']('\x0a')});}else _0xf1a98c[_0x31a3bd(0xfb)](_0x31a3bd(0x1ac)+_0x25f5a9[_0x31a3bd(0xd6)]+_0x31a3bd(0xd2)+(_0x48a037?.[_0x31a3bd(0x162)]||_0x31a3bd(0x1b2))+_0x31a3bd(0x1e9));}try{const _0x1386ab=await compactFileContexts(_0x528b0a,_0x351f2f['data']['search_string'],MORPH_API_KEY,MORPH_API_URL);for(const _0x5e739d of _0x1386ab){_0xf1a98c['push']('<file\x20path=\x22'+_0x5e739d[_0x31a3bd(0xd6)]+_0x31a3bd(0x12c)+_0x5e739d[_0x31a3bd(0x16e)]+_0x31a3bd(0x1e9));}}catch(_0x2dc928){logger[_0x31a3bd(0x123)]('MCP',_0x31a3bd(0x17b),{'error':_0x2dc928 instanceof Error?_0x2dc928[_0x31a3bd(0x162)]:String(_0x2dc928),'files_count':_0x528b0a['length']});for(const _0x2490e3 of _0x528b0a){_0xf1a98c[_0x31a3bd(0xfb)](_0x31a3bd(0x1ac)+_0x2490e3['path']+'\x22>\x0a'+_0x2490e3[_0x31a3bd(0x16e)]+_0x31a3bd(0x1e9));}}_0x3012d7['push'](_0xf1a98c[_0x31a3bd(0xe4)]('\x0a\x0a')),_0x4037bc=_0x3012d7[_0x31a3bd(0xe4)]('\x0a');const _0x4dcd92=_0x3896c9[_0x31a3bd(0xe2)]?.[_0x31a3bd(0x173)](_0x37b2b4=>_0x37b2b4[_0x31a3bd(0x162)]?.[_0x31a3bd(0xff)](_0x31a3bd(0x153)))||[];if(_0x4dcd92[_0x31a3bd(0x148)]>0x0){const _0x44a57d=_0x4dcd92[_0x31a3bd(0x1c4)](_0x43c9d0=>_0x43c9d0[_0x31a3bd(0x162)])[_0x31a3bd(0xe4)](';\x20');reportMorphError({'error_message':_0x44a57d,'error_type':_0x31a3bd(0x142),'context':{'tool':_0x31a3bd(0xc3),'repo_path':_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0x13a)],'query':_0x351f2f['data'][_0x31a3bd(0xd9)],'model':_0x31a3bd(0x144),'termination_reason':_0x31a3bd(0xe7),'error_count':_0x4dcd92[_0x31a3bd(0x148)],'is_timeout':![],'timings':_0x3896c9[_0x31a3bd(0x124)],'files_attempted':_0x5b2085[_0x31a3bd(0x1c4)](_0x1edcf5=>({'path':_0x1edcf5[_0x31a3bd(0xd6)],'lines':_0x1edcf5['lines']})),'tool_calls':_0x4d1d6f(_0x3896c9[_0x31a3bd(0x1e0)]),'messages':_0x3896c9[_0x31a3bd(0x1e0)]?.[_0x31a3bd(0x1c4)](_0x26f160=>({'role':_0x26f160[_0x31a3bd(0xd3)],'content':_0x26f160[_0x31a3bd(0x16e)],..._0x26f160['tool_calls']?{'tool_calls':_0x26f160[_0x31a3bd(0x1ca)][_0x31a3bd(0x148)]}:{},..._0x26f160[_0x31a3bd(0x1dc)]?{'tool_call_id':_0x26f160[_0x31a3bd(0x1dc)]}:{}})),'request_content':{'query':_0x351f2f['data'][_0x31a3bd(0xd9)],'repo_path':_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0x13a)],'repoRoot':a0_0x41cd8c[_0x31a3bd(0x117)](_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0x13a)]),'model':_0x31a3bd(0x144)}},'source':_0x31a3bd(0x109)})[_0x31a3bd(0x145)](()=>{});}}else{if(_0x3896c9[_0x31a3bd(0x14d)]===_0x31a3bd(0x15d)&&_0x3896c9[_0x31a3bd(0xe2)][_0x31a3bd(0x148)]>0x0){const _0x69fb13=_0x3896c9[_0x31a3bd(0xe2)]['map'](_0x2708bf=>_0x2708bf[_0x31a3bd(0x162)])[_0x31a3bd(0xe4)](';\x20');_0x4037bc=_0x31a3bd(0x1df)+_0x69fb13;const _0x32c5e2=_0x69fb13[_0x31a3bd(0x110)]()[_0x31a3bd(0xed)](_0x31a3bd(0x185))||_0x69fb13[_0x31a3bd(0x110)]()[_0x31a3bd(0xed)](_0x31a3bd(0x1de))||_0x69fb13[_0x31a3bd(0x110)]()['includes'](_0x31a3bd(0xc6)),_0x420617=_0x3896c9[_0x31a3bd(0x139)]?.[_0x31a3bd(0x1c1)]?.['files'],_0x3e0e6d=_0x3896c9['errors'][0x0];reportMorphError({'error_message':_0x69fb13,'error_type':_0x32c5e2?'TimeoutError':_0x3e0e6d?.[_0x31a3bd(0x165)]?.[_0x31a3bd(0x113)]||_0x31a3bd(0xca),'context':{'tool':_0x31a3bd(0xc3),'repo_path':_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0x13a)],'query':_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0xd9)],'model':_0x31a3bd(0x144),'termination_reason':_0x3896c9[_0x31a3bd(0x14d)],'error_count':_0x3896c9[_0x31a3bd(0xe2)][_0x31a3bd(0x148)],'is_timeout':_0x32c5e2,'timings':_0x3896c9[_0x31a3bd(0x124)],'files_attempted':_0x420617?.[_0x31a3bd(0x1c4)](_0x474d41=>({'path':_0x474d41[_0x31a3bd(0xd6)],'lines':_0x474d41[_0x31a3bd(0x1a9)]})),'tool_calls':_0x4d1d6f(_0x3896c9[_0x31a3bd(0x1e0)]),'messages':_0x3896c9[_0x31a3bd(0x1e0)]?.[_0x31a3bd(0x1c4)](_0x52c6b5=>({'role':_0x52c6b5[_0x31a3bd(0xd3)],'content':_0x52c6b5[_0x31a3bd(0x16e)],..._0x52c6b5['tool_calls']?{'tool_calls':_0x52c6b5['tool_calls'][_0x31a3bd(0x148)]}:{},..._0x52c6b5['tool_call_id']?{'tool_call_id':_0x52c6b5['tool_call_id']}:{}})),'request_content':{'query':_0x351f2f[_0x31a3bd(0x1b3)]['search_string'],'repo_path':_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0x13a)],'repoRoot':a0_0x41cd8c[_0x31a3bd(0x117)](_0x351f2f[_0x31a3bd(0x1b3)]['repo_path']),'model':_0x31a3bd(0x144)}},'stack_trace':_0x3e0e6d?.['stack']||undefined,'source':_0x31a3bd(0x109)})[_0x31a3bd(0x145)](()=>{});}else _0x4037bc=_0x31a3bd(0x1a1);}return{'content':[{'type':_0x31a3bd(0x164),'text':_0x4037bc}]};}catch(_0x262fea){const _0x4b121=handleMorphAPIError(_0x262fea);if(_0x4b121)return logger[_0x31a3bd(0x14e)](_0x31a3bd(0xc4),_0x31a3bd(0x122),{'tool':_0x31a3bd(0xc3),'error':_0x31a3bd(0x1ae),'latency_ms':Date['now']()-_0x3cf95c}),_0x4b121;const _0x5bab25=_0x262fea instanceof Error?_0x262fea[_0x31a3bd(0x162)]:String(_0x262fea);logger[_0x31a3bd(0x14e)](_0x31a3bd(0xc4),'tool_call_error',{'tool':_0x31a3bd(0xc3),'error':_0x5bab25,'repo_path':_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0x13a)],'query':_0x351f2f[_0x31a3bd(0x1b3)]['search_string'],'latency_ms':Date[_0x31a3bd(0x1ea)]()-_0x3cf95c});const _0x51f976=_0x5bab25[_0x31a3bd(0x110)]()['includes'](_0x31a3bd(0x185))||_0x5bab25[_0x31a3bd(0x110)]()[_0x31a3bd(0xed)](_0x31a3bd(0x1de))||_0x5bab25[_0x31a3bd(0x110)]()['includes'](_0x31a3bd(0xc6))||_0x262fea instanceof Error&&_0x262fea[_0x31a3bd(0x113)]===_0x31a3bd(0x1d7);return reportMorphError({'error_message':_0x5bab25,'error_type':_0x51f976?_0x31a3bd(0x1d7):_0x262fea instanceof Error?_0x262fea[_0x31a3bd(0x165)]['name']:_0x31a3bd(0x1c0),'context':{'tool':_0x31a3bd(0xc3),'repo_path':_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0x13a)],'query':_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0xd9)],'model':_0x31a3bd(0x144),'is_timeout':_0x51f976,'exception_phase':_0x31a3bd(0x176),'request_content':{'query':_0x351f2f['data'][_0x31a3bd(0xd9)],'repo_path':_0x351f2f[_0x31a3bd(0x1b3)][_0x31a3bd(0x13a)],'repoRoot':a0_0x41cd8c['resolve'](_0x351f2f['data'][_0x31a3bd(0x13a)]),'model':_0x31a3bd(0x144)}},'stack_trace':_0x262fea instanceof Error?_0x262fea[_0x31a3bd(0x10a)]:undefined,'source':_0x31a3bd(0x109)})[_0x31a3bd(0x145)](()=>{}),{'content':[{'type':_0x31a3bd(0x164),'text':_0x31a3bd(0x108)+_0x5bab25}],'isError':![]};}}case TOOL_NAMES[_0x31a3bd(0x129)]:{const _0x539188=WarpGrepGitHubArgsSchema[_0x31a3bd(0xe9)](_0x59abb9);if(!_0x539188[_0x31a3bd(0xf9)])return{'content':[{'type':_0x31a3bd(0x164),'text':_0x31a3bd(0x19b)+_0x539188[_0x31a3bd(0x14e)]}],'isError':!![]};const _0xed5cc8=_0x539188[_0x31a3bd(0x1b3)][_0x31a3bd(0x102)]||_0x539188[_0x31a3bd(0x1b3)][_0x31a3bd(0x1a8)];if(!_0xed5cc8)return{'content':[{'type':_0x31a3bd(0x164),'text':_0x31a3bd(0x10e)}],'isError':!![]};const _0x2b3ade=MORPH_API_KEY;if(!_0x2b3ade)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x325492=Date[_0x31a3bd(0x1ea)]();logger[_0x31a3bd(0x14f)]('MCP',_0x31a3bd(0x166),{'identifier':_0xed5cc8,'query':_0x539188[_0x31a3bd(0x1b3)][_0x31a3bd(0xd9)],'branch':_0x539188['data'][_0x31a3bd(0xc0)]});try{const _0xf6df82=new WarpGrepClient({'morphApiKey':_0x2b3ade,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x26574e=await _0xf6df82[_0x31a3bd(0x155)]({'searchTerm':_0x539188['data'][_0x31a3bd(0xd9)],'github':_0xed5cc8,'branch':_0x539188[_0x31a3bd(0x1b3)][_0x31a3bd(0xc0)]}),_0x37082d=Date[_0x31a3bd(0x1ea)]()-_0x325492;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x37082d+'ms.\x20Success:\x20'+_0x26574e['success']);const _0x5933c5=formatResult(_0x26574e);return{'content':[{'type':'text','text':_0x5933c5}]};}catch(_0x4944aa){const _0x1a2a4e=handleMorphAPIError(_0x4944aa);if(_0x1a2a4e)return _0x1a2a4e;const _0x27dca5=Date['now']()-_0x325492,_0x46b2b9=_0x4944aa instanceof Error?_0x4944aa[_0x31a3bd(0x162)]:String(_0x4944aa);return logMcpStderr('[github_codebase_search]\x20Failed\x20in\x20'+_0x27dca5+_0x31a3bd(0x159),_0x46b2b9),reportMorphError({'error_message':_0x46b2b9,'error_type':_0x4944aa instanceof Error?_0x4944aa[_0x31a3bd(0x165)][_0x31a3bd(0x113)]:_0x31a3bd(0x1c0),'context':{'tool':'github_codebase_search','github_url':_0xed5cc8,'search_string':_0x539188[_0x31a3bd(0x1b3)][_0x31a3bd(0xd9)],'branch':_0x539188[_0x31a3bd(0x1b3)]['branch']},'stack_trace':_0x4944aa instanceof Error?_0x4944aa[_0x31a3bd(0x10a)]:undefined,'source':_0x31a3bd(0x109),'tool':_0x31a3bd(0x150),'latency_ms':_0x27dca5})['catch'](()=>{}),{'content':[{'type':'text','text':_0x31a3bd(0x188)+_0x46b2b9}],'isError':![]};}}default:throw new Error(_0x31a3bd(0x157)+_0x2061d5);}}catch(_0x3bccb2){const _0x2a4546=_0x3bccb2 instanceof Error?_0x3bccb2['message']:String(_0x3bccb2);return reportMorphError({'error_message':_0x2a4546,'error_type':_0x3bccb2 instanceof Error?_0x3bccb2[_0x31a3bd(0x165)]['name']:'UnknownError','context':{'tool':_0x2061d5,'arguments':_0x59abb9?JSON['stringify'](_0x59abb9)[_0x31a3bd(0x191)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x3bccb2 instanceof Error?_0x3bccb2[_0x31a3bd(0x10a)]:undefined,'source':_0x31a3bd(0x109)})['catch'](()=>{}),{'content':[{'type':_0x31a3bd(0x164),'text':_0x31a3bd(0x1df)+_0x2a4546}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x1bfd05){const _0x3878ad=a0_0x40eb78,_0x1062ca=await getValidRootDirectories(_0x1bfd05);if(_0x1062ca[_0x3878ad(0x148)]>0x0)allowedDirectories=[..._0x1062ca],logMcpStderr(_0x3878ad(0x19f)+_0x1062ca[_0x3878ad(0x148)]+_0x3878ad(0x13f));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x4a9d31=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x4a9d31&&(allowedDirectories=[_0x4a9d31],logMcpStderr(_0x3878ad(0x1e3)+_0x4a9d31));}catch(_0x824515){logMcpStderr(_0x3878ad(0x15c)+_0x824515);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x4e9246=a0_0x40eb78;try{const _0x2a2d37=await server[_0x4e9246(0xef)]();_0x2a2d37&&'roots'in _0x2a2d37&&await updateAllowedDirectoriesFromRoots(_0x2a2d37[_0x4e9246(0x160)]);}catch(_0x353fbb){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x353fbb instanceof Error?_0x353fbb[_0x4e9246(0x162)]:String(_0x353fbb));}}),server[a0_0x40eb78(0x103)]=async()=>{const _0x116d47=a0_0x40eb78,_0x5366cc=server['getClientCapabilities']();if(_0x5366cc?.[_0x116d47(0x160)])try{const _0x46689a=await server[_0x116d47(0xef)]();_0x46689a&&'roots'in _0x46689a?await updateAllowedDirectoriesFromRoots(_0x46689a[_0x116d47(0x160)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x5a7418){logMcpStderr(_0x116d47(0x1e1),_0x5a7418 instanceof Error?_0x5a7418[_0x116d47(0x162)]:String(_0x5a7418));}else{if(allowedDirectories['length']>0x0)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0x116d47(0x1bd));}}};async function runServer(){const _0x2886b4=a0_0x40eb78,_0x18f143=new StdioServerTransport();await server['connect'](_0x18f143),logMcpStderr(_0x2886b4(0x13b)),allowedDirectories[_0x2886b4(0x148)]===0x0&&logMcpStderr(_0x2886b4(0x10d));}runServer()[a0_0x40eb78(0x145)](_0x5a788f=>{const _0xb5cff4=a0_0x40eb78;logMcpStderr(_0xb5cff4(0x107),_0x5a788f),process[_0xb5cff4(0xfe)](0x1);});
|
|
2
|
+
const a0_0x35c683=a0_0x2a96;(function(_0x451925,_0x280bd9){const _0x23f1ac=a0_0x2a96,_0x111cb1=_0x451925();while(!![]){try{const _0x112bf4=-parseInt(_0x23f1ac(0x106))/0x1+-parseInt(_0x23f1ac(0x129))/0x2+parseInt(_0x23f1ac(0xe3))/0x3+parseInt(_0x23f1ac(0xbd))/0x4+parseInt(_0x23f1ac(0xfd))/0x5+-parseInt(_0x23f1ac(0x11c))/0x6*(parseInt(_0x23f1ac(0x92))/0x7)+-parseInt(_0x23f1ac(0xa3))/0x8;if(_0x112bf4===_0x280bd9)break;else _0x111cb1['push'](_0x111cb1['shift']());}catch(_0x5ebec9){_0x111cb1['push'](_0x111cb1['shift']());}}}(a0_0x2da1,0x4ce63));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_0x4c1682 from'fs/promises';import a0_0xc22154 from'path';import a0_0x44e459 from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{logger}from'./logger.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';function a0_0x2da1(){const _0x515999=['1205067ETTmLJ','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','list_directory\x20','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','roots','Morph\x20Edit\x20Preview','node_modules','\x0a</file>','.\x20Changes:\x20','Applied','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','data','setNotificationHandler','tool_calls','optional','timeout','source','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','api-key','WarpGrep\x20sub-tool\x20errors:\x20','describe','linesRemoved','name','Rules:\x0a','warn','Error:\x20','2720160SVOCGE','messages','parse','code','application/json','codebase_search','instruction','filePath','https://morphllm.com/api/error-report','476741SvwUdS','\x0a...\x20(truncated,\x20total:\x20','pattern','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','FileNotFound','-\x20Grepped\x20\x27','isArray','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','getClientCapabilities','edit_file','now','unknown','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','<file\x20path=\x22','\x20error(s)','tool','normalize','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','grep','MORPH_LARGE_APPLY','137490gVLGkZ','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','target_file','Parent\x20directory\x20does\x20not\x20exist:\x20','terminated','env','grep_search','[github_codebase_search]\x20Failed\x20in\x20','MCP','morph-v3-large','join','\x20-\x20','unknown\x20error','375308WkAiIq','package.json','new_string','\x20\x20morph-mcp','etimedout','API\x20error\x20(auth/rate-limit)','success','post','Failed\x20to\x20read\x20file:\x20','\x0aExamples:','trim','WarpGrepError','argv','turns','warp_grep_complete','setRequestHandler','Invalid\x20arguments:\x20','utf-8','`\x20in\x20`','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','Created\x20File','metadata','completionId','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','file_read_failed','push','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','MORPH_API_KEY','catch','exit','all','Relevant\x20context\x20found:','listRoots','context','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.','message','version','morph-warp-grep-v2.1','linesAdded','response','files','stack','Warning:\x20','LocalRipgrepProvider','target_filepath','enum','tool_call_id','has','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','tsconfig.json','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.','Parameters:\x0a','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','GITHUB_CODEBASE_SEARCH','\x20as\x20allowed\x20directory','UnknownError','\x20disabled\x20via\x20DISABLED_TOOLS','string','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','morph-','text','cwd','Failed\x20to\x20request\x20roots\x20from\x20client:','Unknown\x20tool:\x20','file_path','timed\x20out','morph-v3-fast','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','search_string','**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','Fatal\x20error\x20running\x20server:','map','provider_created','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','indexOf','\x22>\x0a','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.','function','finish','@morphllm/morphmcp\x20','terminationReason','github_url','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Cargo.toml','list_directory','sep','Repository\x20identifier','oninitialized','morph-mcp','go.mod','path_validation_failed','params','runWarpGrep_call','readFile','constructor','added\x20','ms.\x20Success:\x20','every','homedir','false','Workspace\x20mode\x20enabled:\x20Using\x20','includes','Example\x20format:\x0a','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','changes','read\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','min','owner_repo','match','FileReadError','grep\x20\x27','size','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','errors','BinaryFile','Tool\x20','glob','read','content','file_read_complete','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','--help','array','Warning:\x20Workspace\x20fallback\x20failed:\x20','glob\x20\x27','-\x20Read\x20file\x20`','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','\x22>\x0aError\x20reading\x20file:\x20','timings','DISABLED_TOOLS','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','.\x20Path:\x20','sk-','Here\x20is\x20the\x20content\x20of\x20files:\x0a','91YuiFwR','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','pyproject.toml','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.','dirname','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','resolve','0.2.0','Error\x20accessing\x20directory\x20','toLowerCase','linesModified','❌\x20Morph\x20Edit\x20Failed:\x20','\x20is\x20not\x20a\x20directory','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Unknown\x20error','some','ReadError','23824KpZoug','repo_path',',\x20removed\x20','floor','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','length','RipgrepNotAvailable','mcp-filesystem','github_search_start','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','EDIT_FILE','lines','filter','CODEBASE_SEARCH','safeParse','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','.cursor','basename','role','tool_call_error','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','GitHub\x20search\x20failed:\x20','branch','\x22.\x20Known\x20tools:\x20','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','ms:','1338104ZvqJVI','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','status','-\x20Preserve\x20exact\x20indentation\x0a','realpath','command','PWD','Disabled\x20tools:\x20','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','connect','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','\x20chars)','Specific\x20commit\x20hash\x20to\x20search','code_edit','ENABLE_WORKSPACE_MODE','path','edit','slice','startsWith','object','debug','-\x20Listed\x20directory\x20`','error','\x0aOptions:','TimeoutError','split','\x20(new\x20file)','dryRun','Morph\x20Edit\x20','completed_with_file_errors','assistant','log','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','default','SymlinkError','isDirectory','File\x20read\x20error:','instructions'];a0_0x2da1=function(){return _0x515999;};return a0_0x2da1();}import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0xffc5fc from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function a0_0x2a96(_0x23892f,_0x3f3a3d){_0x23892f=_0x23892f-0x8c;const _0x2da193=a0_0x2da1();let _0x2a96cc=_0x2da193[_0x23892f];return _0x2a96cc;}function fixPathRepetition(_0x4d3cd5){const _0x3b5290=a0_0x2a96,_0x4e15d4=_0x4d3cd5['split'](a0_0xc22154[_0x3b5290(0x17f)])['filter'](Boolean);if(_0x4e15d4[_0x3b5290(0xa8)]<0x2)return null;for(let _0x1e1d9e=Math[_0x3b5290(0xa6)](_0x4e15d4[_0x3b5290(0xa8)]/0x2);_0x1e1d9e>=0x1;_0x1e1d9e--){for(let _0x327082=0x0;_0x327082<=_0x4e15d4[_0x3b5290(0xa8)]-0x2*_0x1e1d9e;_0x327082++){const _0x583351=_0x4e15d4[_0x3b5290(0xce)](_0x327082,_0x327082+_0x1e1d9e),_0x1a649a=_0x4e15d4[_0x3b5290(0xce)](_0x327082+_0x1e1d9e,_0x327082+0x2*_0x1e1d9e);if(_0x583351[_0x3b5290(0x18b)]((_0x9fd856,_0x3a891c)=>_0x9fd856===_0x1a649a[_0x3a891c])){const _0x1ef36b=[..._0x4e15d4[_0x3b5290(0xce)](0x0,_0x327082),..._0x4e15d4[_0x3b5290(0xce)](_0x327082+_0x1e1d9e)];return a0_0xc22154[_0x3b5290(0x17f)]+_0x1ef36b[_0x3b5290(0x126)](a0_0xc22154['sep']);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x3b66d5=a0_0x2a96;try{const _0x5b8ce6=require('../package.json');return _0x5b8ce6[_0x3b66d5(0x14d)]??_0x3b66d5(0x112);}catch(_0x17ddc6){return logMcpStderr(_0x3b66d5(0x15d),_0x17ddc6),_0x3b66d5(0x112);}}function printHelp(){const _0x557b7e=a0_0x2a96;console[_0x557b7e(0xdc)](_0x557b7e(0x179)+getPackageVersion()),console['log'](_0x557b7e(0x93)),console[_0x557b7e(0xdc)](_0x557b7e(0xd4)),console[_0x557b7e(0xdc)]('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console['log']('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x557b7e(0xdc)](_0x557b7e(0xe6)),console[_0x557b7e(0xdc)](_0x557b7e(0x132)),console[_0x557b7e(0xdc)](_0x557b7e(0x12c)),console[_0x557b7e(0xdc)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process[a0_0x35c683(0x135)][a0_0x35c683(0xce)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x35c683(0x1a4),'-h']);cliArgs['some'](_0x5057dc=>VERSION_FLAGS[a0_0x35c683(0x158)](_0x5057dc))&&(console[a0_0x35c683(0xdc)](a0_0x35c683(0x179)+getPackageVersion()),process[a0_0x35c683(0x146)](0x0));cliArgs[a0_0x35c683(0xa1)](_0x3222f5=>HELP_FLAGS[a0_0x35c683(0x158)](_0x3222f5))&&(printHelp(),process[a0_0x35c683(0x146)](0x0));function getCliArg(_0x46694e){const _0xb8ced5=a0_0x35c683;for(let _0x6294eb=0x0;_0x6294eb<cliArgs[_0xb8ced5(0xa8)];_0x6294eb++){const _0x294f11=cliArgs[_0x6294eb];if(_0x294f11[_0xb8ced5(0xcf)]('--'+_0x46694e+'='))return _0x294f11['slice'](('--'+_0x46694e+'=')[_0xb8ced5(0xa8)]);if(_0x294f11==='--'+_0x46694e&&_0x6294eb+0x1<cliArgs[_0xb8ced5(0xa8)])return cliArgs[_0x6294eb+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x35c683(0xa8)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x35c683(0x158)](arg)||HELP_FLAGS[a0_0x35c683(0x158)](arg))continue;if(arg[a0_0x35c683(0xcf)]('--api-key='))continue;if(arg==='--api-key'){i++;continue;}args[a0_0x35c683(0x142)](arg);}const WORKSPACE_ROOT=process[a0_0x35c683(0x121)]['WORKSPACE_ROOT']||process[a0_0x35c683(0x121)][a0_0x35c683(0xc3)]||process[a0_0x35c683(0x167)](),ENABLE_WORKSPACE_MODE=process['env'][a0_0x35c683(0xcb)]!==a0_0x35c683(0x18d),MORPH_API_KEY=getCliArg(a0_0x35c683(0xf5))??process[a0_0x35c683(0x121)][a0_0x35c683(0x144)],MORPH_API_URL=process[a0_0x35c683(0x121)]['MORPH_API_URL'],MORPH_LARGE_APPLY=process[a0_0x35c683(0x121)][a0_0x35c683(0x11b)]!==a0_0x35c683(0x18d),MORPH_WARP_GREP_TIMEOUT=process[a0_0x35c683(0x121)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x35c683(0x121)]['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x35c683(0x121)]['DISABLED_TOOLS']?new Set(process[a0_0x35c683(0x121)][a0_0x35c683(0x8d)][a0_0x35c683(0xd6)](',')[a0_0x35c683(0x171)](_0x3ac530=>_0x3ac530[a0_0x35c683(0x133)]())['filter'](_0x2ba7cc=>_0x2ba7cc[a0_0x35c683(0xa8)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x35c683(0x19a)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x35c683(0x158)](tool)&&console['error']('Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22'+tool+a0_0x35c683(0xba)+[...KNOWN_TOOL_NAMES][a0_0x35c683(0x126)](',\x20'));}console[a0_0x35c683(0xd3)](a0_0x35c683(0xc4)+[...DISABLED_TOOLS][a0_0x35c683(0x126)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x35c683(0xcf)](a0_0x35c683(0x90))&&!MORPH_API_KEY[a0_0x35c683(0xcf)](a0_0x35c683(0x165))&&logMcpStderr(a0_0x35c683(0xed));async function reportMorphError(_0x454181){const _0x5b2f46=a0_0x35c683;try{await a0_0xffc5fc[_0x5b2f46(0x130)](_0x5b2f46(0x105),{..._0x454181,'timestamp':new Date()['toISOString'](),'source':_0x454181['source']||_0x5b2f46(0xaa),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x454181[_0x5b2f46(0x14a)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x5b2f46(0x101),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x1d0930,_0x4eaf85){const _0x591947=a0_0x35c683;if(_0x1d0930&&typeof _0x1d0930===_0x591947(0xd0)&&'status'in _0x1d0930)return _0x1d0930['status'];if(_0x1d0930&&typeof _0x1d0930===_0x591947(0xd0)&&_0x591947(0x150)in _0x1d0930)return _0x1d0930[_0x591947(0x150)]?.[_0x591947(0xbf)];const _0x2e6c1d=_0x4eaf85[_0x591947(0x197)](/\b(401|429)\b/);return _0x2e6c1d?parseInt(_0x2e6c1d[0x1],0xa):null;}function handleMorphAPIError(_0x3654ff){const _0x124770=a0_0x35c683,_0x39e272=_0x3654ff instanceof Error?_0x3654ff[_0x124770(0x14c)]:String(_0x3654ff),_0x247c19=extractStatusCode(_0x3654ff,_0x39e272);switch(_0x247c19){case 0x191:return{'content':[{'type':'text','text':_0x124770(0x15b)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x124770(0x166),'text':_0x124770(0xbe)}],'isError':!![]};default:return null;}}args[a0_0x35c683(0xa8)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x35c683(0xc5)),logMcpStderr(a0_0x35c683(0xe4)),logMcpStderr(a0_0x35c683(0x159)),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x35c683(0x17c)),logMcpStderr(a0_0x35c683(0xf4)));function normalizePath(_0x551ab9){const _0xedcca1=a0_0x35c683;return a0_0xc22154[_0xedcca1(0x117)](_0x551ab9);}function expandHome(_0x91538e){const _0x31cc20=a0_0x35c683;if(_0x91538e[_0x31cc20(0xcf)]('~/')||_0x91538e==='~')return a0_0xc22154[_0x31cc20(0x126)](a0_0x44e459[_0x31cc20(0x18c)](),_0x91538e[_0x31cc20(0xce)](0x1));return _0x91538e;}let allowedDirectories=await Promise['all'](args[a0_0x35c683(0x171)](async _0xbc9c90=>{const _0x801e6c=a0_0x35c683,_0x3c8631=expandHome(_0xbc9c90),_0x30d215=a0_0xc22154[_0x801e6c(0x98)](_0x3c8631);try{const _0x54b273=await a0_0x4c1682[_0x801e6c(0xc1)](_0x30d215);return normalizePath(_0x54b273);}catch(_0x1ad87d){return normalizePath(_0x30d215);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x35c683(0x142)](workspaceDir),logMcpStderr(a0_0x35c683(0x18e)+workspaceDir+a0_0x35c683(0x160)));}catch(a0_0x5e7259){logMcpStderr(a0_0x35c683(0x97)+a0_0x5e7259);}async function detectWorkspaceRoot(_0x11e21d){const _0x49afe3=a0_0x35c683;let _0x4df3a5=a0_0xc22154[_0x49afe3(0x98)](_0x11e21d);const _0x27754a=['.git','.vscode',_0x49afe3(0x12a),_0x49afe3(0x17d),_0x49afe3(0x94),_0x49afe3(0x183),_0x49afe3(0xb3),_0x49afe3(0x15a),'composer.json'];while(_0x4df3a5!==a0_0xc22154[_0x49afe3(0x96)](_0x4df3a5)){for(const _0x3e7082 of _0x27754a){const _0xe38176=a0_0xc22154[_0x49afe3(0x126)](_0x4df3a5,_0x3e7082);try{return await a0_0x4c1682['access'](_0xe38176),normalizePath(_0x4df3a5);}catch{}}_0x4df3a5=a0_0xc22154[_0x49afe3(0x96)](_0x4df3a5);}return normalizePath(_0x11e21d);}await Promise[a0_0x35c683(0x147)](args[a0_0x35c683(0x171)](async _0x532324=>{const _0x2c7108=a0_0x35c683;try{const _0x107dcb=await a0_0x4c1682['stat'](expandHome(_0x532324));!_0x107dcb[_0x2c7108(0xe0)]()&&(logMcpStderr(_0x2c7108(0xfc)+_0x532324+_0x2c7108(0x9e)),process[_0x2c7108(0x146)](0x1));}catch(_0x46c054){logMcpStderr(_0x2c7108(0x9a)+_0x532324+':',_0x46c054),process[_0x2c7108(0x146)](0x1);}}));async function validatePath(_0x6d1fe5){const _0x1274a1=a0_0x35c683,_0x3e1d26=expandHome(_0x6d1fe5),_0x4157a7=a0_0xc22154['resolve'](_0x3e1d26);logger[_0x1274a1(0xd1)](_0x1274a1(0x124),'path_validation_start',{'raw_path':_0x6d1fe5,'absolute':_0x4157a7});try{const _0x33c3ca=await a0_0x4c1682[_0x1274a1(0xc1)](_0x4157a7);return logger[_0x1274a1(0xd1)](_0x1274a1(0x124),'path_validation_resolved',{'resolved':_0x33c3ca,'symlink':_0x33c3ca!==_0x4157a7}),_0x33c3ca;}catch(_0x455743){if(_0x455743[_0x1274a1(0x100)]==='ENOENT'){const _0x1761f6=a0_0xc22154[_0x1274a1(0x96)](_0x4157a7);try{const _0x1666b8=await a0_0x4c1682[_0x1274a1(0xc1)](_0x1761f6),_0x119896=a0_0xc22154[_0x1274a1(0x126)](_0x1666b8,a0_0xc22154[_0x1274a1(0xb4)](_0x4157a7));return logger['debug'](_0x1274a1(0x124),'path_validation_resolved',{'resolved':_0x119896,'new_file':!![]}),_0x119896;}catch{logger[_0x1274a1(0xd3)](_0x1274a1(0x124),'path_validation_failed',{'raw_path':_0x6d1fe5,'error':_0x1274a1(0x11f)+_0x1761f6});throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x1761f6);}}logger[_0x1274a1(0xd3)](_0x1274a1(0x124),_0x1274a1(0x184),{'raw_path':_0x6d1fe5,'error':_0x455743[_0x1274a1(0x14c)]});throw _0x455743;}}const MorphEditFileArgsSchema=z[a0_0x35c683(0xd0)]({'path':z[a0_0x35c683(0x163)](),'code_edit':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf7)](a0_0x35c683(0xdd)),'instruction':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf7)](a0_0x35c683(0x173)),'dryRun':z['boolean']()[a0_0x35c683(0xde)](![])['describe']('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x35c683(0x14b),WarpGrepArgsSchema=z[a0_0x35c683(0xd0)]({'search_string':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf7)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf7)](a0_0x35c683(0x194)),'search_type':z[a0_0x35c683(0x156)]([a0_0x35c683(0xde),a0_0x35c683(0xe9)])[a0_0x35c683(0xf1)]()[a0_0x35c683(0xf7)](a0_0x35c683(0xa7))}),WarpGrepGitHubArgsSchema=z[a0_0x35c683(0xd0)]({'search_string':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf7)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf1)]()[a0_0x35c683(0xf7)](a0_0x35c683(0x176)),'owner_repo':z['string']()[a0_0x35c683(0xf1)]()['describe']('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf1)]()['describe']('Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)')}),CodebaseSearchArgsSchema=z[a0_0x35c683(0xd0)]({'query':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf7)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf7)](a0_0x35c683(0x180)),'branch':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf1)]()[a0_0x35c683(0xf7)](a0_0x35c683(0x10d)),'commitHash':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf1)]()[a0_0x35c683(0xf7)](a0_0x35c683(0xc9)),'targetDirectories':z[a0_0x35c683(0x1a5)](z[a0_0x35c683(0x163)]())['default']([])[a0_0x35c683(0xf7)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z['number']()[a0_0x35c683(0xf1)]()[a0_0x35c683(0xde)](0xa)[a0_0x35c683(0xf7)]('Max\x20results\x20to\x20return')}),server=new Server({'name':a0_0x35c683(0x182),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x35c683(0x138)](ListToolsRequestSchema,async()=>{const _0x1f5841=a0_0x35c683,_0x4b26a3=[{'name':TOOL_NAMES['EDIT_FILE'],'description':_0x1f5841(0x16f)+_0x1f5841(0x15c)+'-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a'+_0x1f5841(0xbb)+_0x1f5841(0x109)+_0x1f5841(0x1a3)+_0x1f5841(0x190)+'//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a'+_0x1f5841(0xfa)+_0x1f5841(0x118)+_0x1f5841(0xc0)+_0x1f5841(0x119)+_0x1f5841(0xac),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x1f5841(0xb0)],'description':_0x1f5841(0x11d)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x1f5841(0x13c)+_0x1f5841(0x143)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x49e866=_0x4b26a3[_0x1f5841(0xaf)](_0x2dd1d3=>{const _0x5824c6=_0x1f5841;if(DISABLED_TOOLS[_0x5824c6(0x158)](_0x2dd1d3[_0x5824c6(0xf9)]))return console[_0x5824c6(0xd3)](_0x5824c6(0x19e)+_0x2dd1d3[_0x5824c6(0xf9)]+_0x5824c6(0x162)),![];if('requiresApiKey'in _0x2dd1d3&&_0x2dd1d3['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0x5824c6(0x153)+_0x2dd1d3[_0x5824c6(0xf9)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x49e866[_0x1f5841(0x171)](_0x28e456=>({'name':_0x28e456[_0x1f5841(0xf9)],'description':_0x28e456['description'],'inputSchema':_0x28e456['inputSchema']}))};}),server[a0_0x35c683(0x138)](CallToolRequestSchema,async _0x320ac6=>{const _0x205f40=a0_0x35c683,{name:_0x243636,arguments:_0x1cbe99}=_0x320ac6[_0x205f40(0x185)],_0x16db6d=Date['now']();logger[_0x205f40(0xd1)]('MCP','tool_call_received',{'tool':_0x243636,'args':_0x243636===_0x205f40(0x110)?{'path':_0x1cbe99?.[_0x205f40(0xcc)],'instruction':_0x1cbe99?.[_0x205f40(0x103)]||_0x1cbe99?.[_0x205f40(0xe2)],'dryRun':_0x1cbe99?.[_0x205f40(0xd8)]}:_0x1cbe99});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x205f40(0x166),'text':_0x205f40(0x113)}],'isError':!![]};if(!MORPH_API_KEY['startsWith'](_0x205f40(0x90))&&!MORPH_API_KEY[_0x205f40(0xcf)](_0x205f40(0x165)))return{'content':[{'type':_0x205f40(0x166),'text':'Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.'}],'isError':!![]};if(DISABLED_TOOLS[_0x205f40(0x158)](_0x243636))return{'content':[{'type':_0x205f40(0x166),'text':'Tool\x20\x22'+_0x243636+_0x205f40(0x140)}],'isError':![]};switch(_0x243636){case TOOL_NAMES[_0x205f40(0xad)]:{let _0x349281=_0x1cbe99;if(_0x349281&&typeof _0x349281===_0x205f40(0xd0)){if(!('path'in _0x349281)){const _0x37c408=_0x349281[_0x205f40(0x11e)]??_0x349281[_0x205f40(0x104)]??_0x349281[_0x205f40(0x155)]??_0x349281[_0x205f40(0x16a)]??_0x349281['file'];if(_0x37c408)_0x349281={..._0x349281,'path':_0x37c408};}_0x205f40(0xe2)in _0x349281&&!('instruction'in _0x349281)&&(_0x349281={..._0x349281,'instruction':_0x349281[_0x205f40(0xe2)]});if(!(_0x205f40(0xca)in _0x349281)){const _0x5848e6=_0x349281[_0x205f40(0x100)]??_0x349281[_0x205f40(0x12b)]??_0x349281[_0x205f40(0x1a1)]??_0x349281[_0x205f40(0xcd)];if(_0x5848e6)_0x349281={..._0x349281,'code_edit':_0x5848e6};}}const _0x29d834=MorphEditFileArgsSchema[_0x205f40(0xb1)](_0x349281);if(!_0x29d834['success'])throw new Error(_0x205f40(0x15e)+_0x29d834[_0x205f40(0xd3)]);const _0x271a56=await validatePath(_0x29d834[_0x205f40(0xee)][_0x205f40(0xcc)]);let _0x441132=null,_0x42500a=!![],_0x48847d=null;try{_0x441132=await a0_0x4c1682['readFile'](_0x271a56,_0x205f40(0x13a)),logger['debug']('MCP',_0x205f40(0x1a2),{'path':_0x271a56,'size_bytes':_0x441132[_0x205f40(0xa8)]});}catch(_0x99302e){const _0x1a54c0=_0x99302e['code'];_0x1a54c0==='ENOENT'?(_0x42500a=![],_0x441132='',logger[_0x205f40(0xd1)](_0x205f40(0x124),_0x205f40(0x1a2),{'path':_0x271a56,'exists':![]})):(_0x48847d=_0x205f40(0x131)+(_0x1a54c0||'unknown')+_0x205f40(0x127)+(_0x99302e instanceof Error?_0x99302e[_0x205f40(0x14c)]:String(_0x99302e)),logger[_0x205f40(0xd3)](_0x205f40(0x124),_0x205f40(0x141),{'path':_0x271a56,'error':_0x48847d}),logMcpStderr(_0x205f40(0x153)+_0x48847d));}let _0xbaa3b2;try{const _0xc276aa=MORPH_API_KEY;if(!_0xc276aa)throw new Error(_0x205f40(0x9f));const _0x24aa56=a0_0xc22154['dirname'](_0x271a56),_0x446ff8=a0_0xc22154[_0x205f40(0xb4)](_0x271a56);logger[_0x205f40(0xd1)](_0x205f40(0x124),'api_request_start',{'model':_0x205f40(0x16c),'path':_0x29d834['data'][_0x205f40(0xcc)],'instruction_len':_0x29d834[_0x205f40(0xee)]['instruction'][_0x205f40(0xa8)],'code_edit_len':_0x29d834[_0x205f40(0xee)][_0x205f40(0xca)][_0x205f40(0xa8)],'original_code_len':_0x441132?.[_0x205f40(0xa8)]??0x0,'dry_run':_0x29d834[_0x205f40(0xee)]['dryRun']});const _0x4c1b6a=Date['now'](),_0x2999c2=await executeEditFile({'target_filepath':_0x446ff8,'code_edit':_0x29d834[_0x205f40(0xee)][_0x205f40(0xca)],'instruction':_0x29d834[_0x205f40(0xee)][_0x205f40(0x103)]},{'morphApiKey':_0xc276aa,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x24aa56,'autoWrite':!_0x29d834[_0x205f40(0xee)]['dryRun'],'generateUdiff':![],'debug':![]}),_0x4506ce=Date[_0x205f40(0x111)]()-_0x4c1b6a;_0xbaa3b2=_0x2999c2[_0x205f40(0x13f)];if(!_0x2999c2[_0x205f40(0x12f)])throw new Error(_0x2999c2['error']||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0xe2d6db=_0x2999c2[_0x205f40(0x192)],_0x379e1c=_0x205f40(0x189)+_0xe2d6db['linesAdded']+_0x205f40(0xa5)+_0xe2d6db[_0x205f40(0xf8)]+',\x20modified\x20'+_0xe2d6db[_0x205f40(0x9c)];logger[_0x205f40(0xd1)]('MCP','tool_call_complete',{'tool':_0x205f40(0x110),'success':!![],'latency_ms':Date[_0x205f40(0x111)]()-_0x16db6d,'edit_latency_ms':_0x4506ce,'changes':{'added':_0xe2d6db[_0x205f40(0x14f)],'removed':_0xe2d6db[_0x205f40(0xf8)],'modified':_0xe2d6db[_0x205f40(0x9c)]},'completion_id':_0xbaa3b2});if(_0x29d834[_0x205f40(0xee)][_0x205f40(0xd8)])return{'content':[{'type':'text','text':_0x205f40(0xe8)+(_0x42500a?'':_0x205f40(0xd7))+':\x20'+_0x29d834[_0x205f40(0xee)][_0x205f40(0x103)]+'.\x20Changes:\x20'+_0x379e1c+_0x205f40(0x8f)+_0x29d834[_0x205f40(0xee)]['path']+'.'}]};return{'content':[{'type':_0x205f40(0x166),'text':_0x205f40(0xd9)+(_0x42500a?_0x205f40(0xec):_0x205f40(0x13d))+':\x20'+_0x29d834['data'][_0x205f40(0x103)]+_0x205f40(0xeb)+_0x379e1c+_0x205f40(0x8f)+_0x29d834[_0x205f40(0xee)]['path']+'.'}]};}catch(_0x56b238){const _0x587914=handleMorphAPIError(_0x56b238);if(_0x587914)return logger['error'](_0x205f40(0x124),_0x205f40(0xb6),{'tool':'edit_file','error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date['now']()-_0x16db6d}),_0x587914;const _0x2b1756=_0x56b238 instanceof Error?_0x56b238['message']:String(_0x56b238);return logger[_0x205f40(0xd3)](_0x205f40(0x124),_0x205f40(0xb6),{'tool':_0x205f40(0x110),'error':_0x2b1756,'path':_0x29d834[_0x205f40(0xee)][_0x205f40(0xcc)],'validated_path':_0x271a56,'latency_ms':Date['now']()-_0x16db6d,'stack':_0x56b238 instanceof Error?_0x56b238[_0x205f40(0x152)]:undefined}),reportMorphError({'error_message':_0x2b1756,'error_type':_0x56b238 instanceof Error?_0x56b238[_0x205f40(0x188)][_0x205f40(0xf9)]:_0x205f40(0x161),'context':{'tool':_0x205f40(0x110),'completion_id':_0xbaa3b2,'file_path':_0x29d834[_0x205f40(0xee)]['path'],'validated_path':_0x271a56,'instruction':_0x29d834[_0x205f40(0xee)][_0x205f40(0x103)],'model':MORPH_LARGE_APPLY?_0x205f40(0x125):'morph-v3-fast','dry_run':_0x29d834[_0x205f40(0xee)][_0x205f40(0xd8)],'file_exists':_0x42500a,'file_read_error':_0x48847d,'file_readable':_0x441132!==null,'request_content':{'path':_0x29d834['data'][_0x205f40(0xcc)],'code_edit':_0x29d834[_0x205f40(0xee)][_0x205f40(0xca)],'instruction':_0x29d834[_0x205f40(0xee)]['instruction'],'original_code':_0x441132!==null?_0x441132[_0x205f40(0xa8)]>0xc350?_0x441132['substring'](0x0,0xc350)+_0x205f40(0x107)+_0x441132[_0x205f40(0xa8)]+_0x205f40(0xc8):_0x441132:'[could\x20not\x20read\x20file:\x20'+(_0x48847d||_0x205f40(0x128))+']','original_code_length':_0x441132?.['length']??0x0,'model':MORPH_LARGE_APPLY?_0x205f40(0x125):_0x205f40(0x16c),'dry_run':_0x29d834[_0x205f40(0xee)][_0x205f40(0xd8)]}},'stack_trace':_0x56b238 instanceof Error?_0x56b238[_0x205f40(0x152)]:undefined,'source':_0x205f40(0xaa)})[_0x205f40(0x145)](()=>{}),{'content':[{'type':_0x205f40(0x166),'text':_0x205f40(0x9d)+_0x2b1756}],'isError':!![]};}}case TOOL_NAMES[_0x205f40(0xb0)]:{const _0x47fb36=WarpGrepArgsSchema[_0x205f40(0xb1)](_0x1cbe99);if(!_0x47fb36['success'])return{'content':[{'type':_0x205f40(0x166),'text':'Invalid\x20arguments:\x20'+_0x47fb36[_0x205f40(0xd3)]}],'isError':!![]};const _0xd5874c=_0x420e64=>{const _0x3d2e67=_0x205f40,_0x3d9de9=[];for(const _0x1b393e of _0x420e64||[]){if(_0x1b393e[_0x3d2e67(0xb5)]==='assistant'&&Array[_0x3d2e67(0x10c)](_0x1b393e[_0x3d2e67(0xf0)]))for(const _0x1e3534 of _0x1b393e[_0x3d2e67(0xf0)]){try{const _0x5131d0=_0x1e3534[_0x3d2e67(0x177)]?.[_0x3d2e67(0xf9)],_0x5c8df5=JSON[_0x3d2e67(0xff)](_0x1e3534[_0x3d2e67(0x177)]?.['arguments']||'{}');if(_0x5131d0===_0x3d2e67(0x122))_0x3d9de9['push'](_0x3d2e67(0x199)+_0x5c8df5[_0x3d2e67(0x108)]+'\x27\x20'+(_0x5c8df5[_0x3d2e67(0xcc)]||'.'));else{if(_0x5131d0===_0x3d2e67(0x1a0))_0x3d9de9[_0x3d2e67(0x142)](_0x3d2e67(0x193)+_0x5c8df5[_0x3d2e67(0xcc)]);else{if(_0x5131d0===_0x3d2e67(0x17e))_0x3d9de9[_0x3d2e67(0x142)](_0x3d2e67(0xe5)+(_0x5c8df5['command']||'.'));else{if(_0x5131d0===_0x3d2e67(0x19f))_0x3d9de9[_0x3d2e67(0x142)](_0x3d2e67(0x1a7)+_0x5c8df5[_0x3d2e67(0x108)]+'\x27\x20'+(_0x5c8df5[_0x3d2e67(0xcc)]||'.'));else _0x5131d0===_0x3d2e67(0x178)&&_0x3d9de9[_0x3d2e67(0x142)]('finish');}}}}catch{}}}return _0x3d9de9;},_0x5a1b95=_0x1d42df=>{const _0x59e437=_0x205f40,_0x3f8a77=[];if(!_0x1d42df||!Array[_0x59e437(0x10c)](_0x1d42df))return _0x3f8a77;const _0xe3abda=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x59e437(0x10a),'tool':_0x59e437(0x1a0)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x59e437(0x1a0)},{'pattern':/\[READ ERROR\]/,'error_type':_0x59e437(0xa2),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x59e437(0x19d),'tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':_0x59e437(0x11a)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x59e437(0xa9),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':_0x59e437(0x19d),'tool':_0x59e437(0x1a0)},{'pattern':/\[SYMLINK\]/,'error_type':_0x59e437(0xdf),'tool':_0x59e437(0x1a0)},{'pattern':/not a text file/,'error_type':_0x59e437(0x19d),'tool':_0x59e437(0x1a0)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x59e437(0x1a0)},{'pattern':/Error reading file:/,'error_type':_0x59e437(0xa2),'tool':_0x59e437(0x1a0)},{'pattern':/status="error"/,'error_type':'ToolException','tool':'unknown'}];let _0x3df4c1=0x0;for(const _0x5a4805 of _0x1d42df){_0x5a4805[_0x59e437(0xb5)]===_0x59e437(0xdb)&&Array['isArray'](_0x5a4805[_0x59e437(0xf0)])&&_0x3df4c1++;const _0x20e93e=_0x5a4805['content'];if((_0x5a4805[_0x59e437(0xb5)]===_0x59e437(0x116)||_0x5a4805[_0x59e437(0xb5)]==='user')&&_0x20e93e&&typeof _0x20e93e===_0x59e437(0x163))for(const {pattern:_0x3b94dc,error_type:_0x2e3e12,tool:_0x4d7871}of _0xe3abda){const _0x4c7244=_0x20e93e[_0x59e437(0x197)](new RegExp(_0x3b94dc[_0x59e437(0xf3)],'g'));if(_0x4c7244)for(const _0xbb564e of _0x4c7244){const _0x129c90=_0x20e93e[_0x59e437(0x174)](_0xbb564e),_0x11db85=_0x20e93e['substring'](_0x129c90,Math[_0x59e437(0x195)](_0x129c90+0xc8,_0x20e93e[_0x59e437(0xa8)]));_0x3f8a77[_0x59e437(0x142)]({'tool':_0x4d7871,'error_type':_0x2e3e12,'error_message':_0x11db85['split']('\x0a')[0x0],'turn':_0x3df4c1});}}}return _0x3f8a77;};try{const _0x2e0e73=a0_0xc22154[_0x205f40(0x98)](_0x47fb36[_0x205f40(0xee)][_0x205f40(0xa4)]),_0x323f76=_0x47fb36['data']['search_type'],_0x457ea4=_0x323f76===_0x205f40(0xe9)?{'allowNames':['node_modules']}:undefined,_0x4b4622=new LocalRipgrepProvider(_0x2e0e73,undefined,_0x457ea4);logger[_0x205f40(0xd1)](_0x205f40(0x124),_0x205f40(0x172),{'type':_0x205f40(0x154),'repo_root':_0x2e0e73,'search_type':_0x323f76||_0x205f40(0xde)}),logger[_0x205f40(0xd1)](_0x205f40(0x124),'warp_grep_start',{'query':_0x47fb36[_0x205f40(0xee)][_0x205f40(0x16e)],'repo_root':_0x2e0e73,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x1f9b88=Date[_0x205f40(0x111)](),_0x1e9c08=await runWarpGrep({'searchTerm':_0x47fb36[_0x205f40(0xee)][_0x205f40(0x16e)],'repoRoot':_0x2e0e73,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x4b4622,'search_type':_0x323f76}),_0x1f8205=Date[_0x205f40(0x111)]()-_0x1f9b88,_0x3f1398=_0x1e9c08[_0x205f40(0x178)]?.[_0x205f40(0x13e)]?.[_0x205f40(0x151)]?.[_0x205f40(0xa8)]??0x0;logger['debug']('MCP',_0x205f40(0x137),{'termination':_0x1e9c08['terminationReason'],'turns':_0x1e9c08[_0x205f40(0x8c)]?.[_0x205f40(0x136)]??0x0,'files_found':_0x3f1398,'latency_ms':_0x1f8205});const _0x4c2fd8=_0x5a1b95(_0x1e9c08[_0x205f40(0xfe)]);_0x4c2fd8[_0x205f40(0xa8)]>0x0&&reportMorphError({'error_message':_0x205f40(0xf6)+_0x4c2fd8['length']+_0x205f40(0x115),'error_type':'SubToolError','level':_0x205f40(0xfb),'tool':_0x205f40(0x102),'context':{'repo_path':_0x47fb36[_0x205f40(0xee)][_0x205f40(0xa4)],'query':_0x47fb36[_0x205f40(0xee)]['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0x1e9c08[_0x205f40(0x17a)],'sub_tool_errors':_0x4c2fd8,'timings':_0x1e9c08[_0x205f40(0x8c)],'tool_calls':_0xd5874c(_0x1e9c08[_0x205f40(0xfe)]),'messages':_0x1e9c08[_0x205f40(0xfe)]?.[_0x205f40(0x171)](_0x4660a4=>({'role':_0x4660a4['role'],'content':_0x4660a4[_0x205f40(0x1a1)],..._0x4660a4[_0x205f40(0xf0)]?{'tool_calls':_0x4660a4['tool_calls']['length']}:{},..._0x4660a4[_0x205f40(0x157)]?{'tool_call_id':_0x4660a4['tool_call_id']}:{}}))},'source':_0x205f40(0xaa)})[_0x205f40(0x145)](()=>{});let _0x2fa726='';if(_0x1e9c08[_0x205f40(0x17a)]==='completed'&&_0x1e9c08[_0x205f40(0x178)]?.[_0x205f40(0x13e)]?.['files']){const _0x5ec049=_0x1e9c08[_0x205f40(0x178)][_0x205f40(0x13e)]['files'];if(_0x5ec049[_0x205f40(0xa8)]===0x0)return _0x2fa726=_0x1e9c08['finish']['payload']||_0x205f40(0x1a9),{'content':[{'type':_0x205f40(0x166),'text':_0x2fa726}]};const _0xb6e96f=[],_0x211b95=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x311043 of _0x1e9c08['messages']){if(_0x311043[_0x205f40(0xb5)]===_0x205f40(0xdb)&&Array[_0x205f40(0x10c)](_0x311043[_0x205f40(0xf0)]))for(const _0x3b0d47 of _0x311043[_0x205f40(0xf0)]){try{const _0x5a9373=_0x3b0d47[_0x205f40(0x177)]?.[_0x205f40(0xf9)],_0x1ff7fa=JSON[_0x205f40(0xff)](_0x3b0d47[_0x205f40(0x177)]?.['arguments']||'{}');if(_0x5a9373===_0x205f40(0x122))_0x211b95['push'](_0x205f40(0x10b)+_0x1ff7fa[_0x205f40(0x108)]+'\x27\x20in\x20`'+(_0x1ff7fa[_0x205f40(0xcc)]||'.')+'`');else{if(_0x5a9373===_0x205f40(0x1a0))_0x211b95['push'](_0x205f40(0x1a8)+_0x1ff7fa[_0x205f40(0xcc)]+'`');else{if(_0x5a9373===_0x205f40(0x17e))_0x211b95['push'](_0x205f40(0xd2)+(_0x1ff7fa[_0x205f40(0xc2)]||'.')+'`');else _0x5a9373===_0x205f40(0x19f)&&_0x211b95[_0x205f40(0x142)]('-\x20Glob\x20search\x20`'+_0x1ff7fa[_0x205f40(0x108)]+_0x205f40(0x13b)+(_0x1ff7fa[_0x205f40(0xcc)]||'.')+'`');}}}catch{}}}_0xb6e96f[_0x205f40(0x142)](_0x211b95[_0x205f40(0x126)]('\x0a'));const _0x2933b0=['',_0x205f40(0x148)];for(const _0x48648c of _0x5ec049){if(_0x48648c[_0x205f40(0xae)]==='*')_0x2933b0[_0x205f40(0x142)]('-\x20'+_0x48648c[_0x205f40(0xcc)]+':*');else{if(Array[_0x205f40(0x10c)](_0x48648c[_0x205f40(0xae)])){const _0xb1d473=_0x48648c[_0x205f40(0xae)][_0x205f40(0x171)](([_0x1fddaa,_0x2c8cef])=>{if(_0x1fddaa===_0x2c8cef)return''+_0x1fddaa;return _0x1fddaa+'-'+_0x2c8cef;});_0x2933b0[_0x205f40(0x142)]('-\x20'+_0x48648c[_0x205f40(0xcc)]+':'+_0xb1d473[_0x205f40(0x126)](','));}else _0x2933b0['push']('-\x20'+_0x48648c[_0x205f40(0xcc)]+':*');}}_0x2933b0[_0x205f40(0x142)](''),_0xb6e96f[_0x205f40(0x142)](_0x2933b0[_0x205f40(0x126)]('\x0a')),_0xb6e96f[_0x205f40(0x142)](_0x205f40(0x91));const _0x228d2d=[],_0x2e170a=[];for(const _0xd7bb26 of _0x5ec049){let _0x3e9232=a0_0xc22154[_0x205f40(0x98)](_0x47fb36['data']['repo_path'],_0xd7bb26[_0x205f40(0xcc)]),_0x234402=null,_0x3c5033=null;try{_0x234402=await a0_0x4c1682[_0x205f40(0x187)](_0x3e9232,{'encoding':_0x205f40(0x13a)});}catch(_0x3569b0){const _0x65358a=fixPathRepetition(_0x3e9232);if(_0x65358a)try{_0x234402=await a0_0x4c1682[_0x205f40(0x187)](_0x65358a,{'encoding':_0x205f40(0x13a)}),_0x3e9232=_0x65358a;}catch{_0x3c5033=_0x3569b0 instanceof Error?_0x3569b0:new Error(String(_0x3569b0));}else _0x3c5033=_0x3569b0 instanceof Error?_0x3569b0:new Error(String(_0x3569b0));}if(_0x234402!==null){const _0x3fef55=_0x234402[_0x205f40(0xd6)](/\r?\n/),_0x2ed25e=[];if(_0xd7bb26[_0x205f40(0xae)]==='*'||!Array['isArray'](_0xd7bb26[_0x205f40(0xae)]))for(let _0x18c8d4=0x1;_0x18c8d4<=_0x3fef55['length'];_0x18c8d4++){const _0xce2438=_0x3fef55[_0x18c8d4-0x1];_0x2ed25e[_0x205f40(0x142)](_0x18c8d4+'|\x20'+_0xce2438);}else for(const [_0x3b960c,_0x344d37]of _0xd7bb26[_0x205f40(0xae)]){_0x2ed25e['length']>0x0&&_0x2ed25e[_0x205f40(0x142)]('');for(let _0x59b90f=_0x3b960c;_0x59b90f<=_0x344d37&&_0x59b90f<=_0x3fef55[_0x205f40(0xa8)];_0x59b90f++){const _0x13f222=_0x3fef55[_0x59b90f-0x1];_0x2ed25e[_0x205f40(0x142)](_0x59b90f+'|\x20'+_0x13f222);}}_0x2e170a[_0x205f40(0x142)]({'path':_0xd7bb26['path'],'content':_0x2ed25e[_0x205f40(0x126)]('\x0a')});}else _0x228d2d[_0x205f40(0x142)](_0x205f40(0x114)+_0xd7bb26[_0x205f40(0xcc)]+_0x205f40(0x1aa)+(_0x3c5033?.[_0x205f40(0x14c)]||_0x205f40(0xa0))+_0x205f40(0xea));}try{const _0x15c090=await compactFileContexts(_0x2e170a,_0x47fb36['data'][_0x205f40(0x16e)],MORPH_API_KEY,MORPH_API_URL);for(const _0x3613b7 of _0x15c090){_0x228d2d[_0x205f40(0x142)](_0x205f40(0x114)+_0x3613b7[_0x205f40(0xcc)]+_0x205f40(0x175)+_0x3613b7[_0x205f40(0x1a1)]+_0x205f40(0xea));}}catch(_0x3e7c65){logger[_0x205f40(0xfb)](_0x205f40(0x124),'compaction_failed',{'error':_0x3e7c65 instanceof Error?_0x3e7c65[_0x205f40(0x14c)]:String(_0x3e7c65),'files_count':_0x2e170a[_0x205f40(0xa8)]});for(const _0x43cd25 of _0x2e170a){_0x228d2d[_0x205f40(0x142)]('<file\x20path=\x22'+_0x43cd25[_0x205f40(0xcc)]+_0x205f40(0x175)+_0x43cd25[_0x205f40(0x1a1)]+_0x205f40(0xea));}}_0xb6e96f[_0x205f40(0x142)](_0x228d2d['join']('\x0a\x0a')),_0x2fa726=_0xb6e96f[_0x205f40(0x126)]('\x0a');const _0x1a2f9e=_0x1e9c08[_0x205f40(0x19c)]?.[_0x205f40(0xaf)](_0x2df4af=>_0x2df4af[_0x205f40(0x14c)]?.['startsWith'](_0x205f40(0xe1)))||[];if(_0x1a2f9e['length']>0x0){const _0x3df723=_0x1a2f9e['map'](_0x5f0d19=>_0x5f0d19[_0x205f40(0x14c)])[_0x205f40(0x126)](';\x20');reportMorphError({'error_message':_0x3df723,'error_type':_0x205f40(0x198),'context':{'tool':_0x205f40(0x102),'repo_path':_0x47fb36[_0x205f40(0xee)][_0x205f40(0xa4)],'query':_0x47fb36[_0x205f40(0xee)][_0x205f40(0x16e)],'model':_0x205f40(0x14e),'termination_reason':_0x205f40(0xda),'error_count':_0x1a2f9e[_0x205f40(0xa8)],'is_timeout':![],'timings':_0x1e9c08[_0x205f40(0x8c)],'files_attempted':_0x5ec049[_0x205f40(0x171)](_0x3bdcc4=>({'path':_0x3bdcc4['path'],'lines':_0x3bdcc4[_0x205f40(0xae)]})),'tool_calls':_0xd5874c(_0x1e9c08[_0x205f40(0xfe)]),'messages':_0x1e9c08[_0x205f40(0xfe)]?.[_0x205f40(0x171)](_0x181915=>({'role':_0x181915[_0x205f40(0xb5)],'content':_0x181915[_0x205f40(0x1a1)],..._0x181915[_0x205f40(0xf0)]?{'tool_calls':_0x181915[_0x205f40(0xf0)][_0x205f40(0xa8)]}:{},..._0x181915['tool_call_id']?{'tool_call_id':_0x181915[_0x205f40(0x157)]}:{}})),'request_content':{'query':_0x47fb36[_0x205f40(0xee)][_0x205f40(0x16e)],'repo_path':_0x47fb36[_0x205f40(0xee)][_0x205f40(0xa4)],'repoRoot':a0_0xc22154[_0x205f40(0x98)](_0x47fb36[_0x205f40(0xee)]['repo_path']),'model':'morph-warp-grep-v2.1'}},'source':_0x205f40(0xaa)})['catch'](()=>{});}}else{if(_0x1e9c08[_0x205f40(0x17a)]===_0x205f40(0x120)&&_0x1e9c08[_0x205f40(0x19c)][_0x205f40(0xa8)]>0x0){const _0x12467a=_0x1e9c08[_0x205f40(0x19c)]['map'](_0xc43bb2=>_0xc43bb2[_0x205f40(0x14c)])[_0x205f40(0x126)](';\x20');_0x2fa726=_0x205f40(0xfc)+_0x12467a;const _0x401d9b=_0x12467a['toLowerCase']()[_0x205f40(0x18f)](_0x205f40(0xf2))||_0x12467a[_0x205f40(0x9b)]()[_0x205f40(0x18f)]('timed\x20out')||_0x12467a['toLowerCase']()[_0x205f40(0x18f)](_0x205f40(0x12d)),_0x17adbd=_0x1e9c08[_0x205f40(0x178)]?.['metadata']?.['files'],_0x548e3e=_0x1e9c08[_0x205f40(0x19c)][0x0];reportMorphError({'error_message':_0x12467a,'error_type':_0x401d9b?_0x205f40(0xd5):_0x548e3e?.[_0x205f40(0x188)]?.[_0x205f40(0xf9)]||_0x205f40(0x134),'context':{'tool':_0x205f40(0x102),'repo_path':_0x47fb36[_0x205f40(0xee)]['repo_path'],'query':_0x47fb36['data'][_0x205f40(0x16e)],'model':_0x205f40(0x14e),'termination_reason':_0x1e9c08[_0x205f40(0x17a)],'error_count':_0x1e9c08['errors'][_0x205f40(0xa8)],'is_timeout':_0x401d9b,'timings':_0x1e9c08[_0x205f40(0x8c)],'files_attempted':_0x17adbd?.[_0x205f40(0x171)](_0x11353f=>({'path':_0x11353f[_0x205f40(0xcc)],'lines':_0x11353f[_0x205f40(0xae)]})),'tool_calls':_0xd5874c(_0x1e9c08[_0x205f40(0xfe)]),'messages':_0x1e9c08['messages']?.[_0x205f40(0x171)](_0x3d5553=>({'role':_0x3d5553['role'],'content':_0x3d5553[_0x205f40(0x1a1)],..._0x3d5553[_0x205f40(0xf0)]?{'tool_calls':_0x3d5553['tool_calls'][_0x205f40(0xa8)]}:{},..._0x3d5553[_0x205f40(0x157)]?{'tool_call_id':_0x3d5553[_0x205f40(0x157)]}:{}})),'request_content':{'query':_0x47fb36['data'][_0x205f40(0x16e)],'repo_path':_0x47fb36[_0x205f40(0xee)][_0x205f40(0xa4)],'repoRoot':a0_0xc22154[_0x205f40(0x98)](_0x47fb36[_0x205f40(0xee)][_0x205f40(0xa4)]),'model':_0x205f40(0x14e)}},'stack_trace':_0x548e3e?.['stack']||undefined,'source':_0x205f40(0xaa)})[_0x205f40(0x145)](()=>{});}else _0x2fa726=_0x205f40(0x191);}return{'content':[{'type':_0x205f40(0x166),'text':_0x2fa726}]};}catch(_0x352c0e){const _0x5ea769=handleMorphAPIError(_0x352c0e);if(_0x5ea769)return logger['error']('MCP',_0x205f40(0xb6),{'tool':_0x205f40(0x102),'error':_0x205f40(0x12e),'latency_ms':Date[_0x205f40(0x111)]()-_0x16db6d}),_0x5ea769;const _0x51955f=_0x352c0e instanceof Error?_0x352c0e[_0x205f40(0x14c)]:String(_0x352c0e);logger['error'](_0x205f40(0x124),_0x205f40(0xb6),{'tool':_0x205f40(0x102),'error':_0x51955f,'repo_path':_0x47fb36['data'][_0x205f40(0xa4)],'query':_0x47fb36[_0x205f40(0xee)][_0x205f40(0x16e)],'latency_ms':Date[_0x205f40(0x111)]()-_0x16db6d});const _0x35ae96=_0x51955f['toLowerCase']()[_0x205f40(0x18f)](_0x205f40(0xf2))||_0x51955f[_0x205f40(0x9b)]()[_0x205f40(0x18f)](_0x205f40(0x16b))||_0x51955f[_0x205f40(0x9b)]()['includes'](_0x205f40(0x12d))||_0x352c0e instanceof Error&&_0x352c0e[_0x205f40(0xf9)]===_0x205f40(0xd5);return reportMorphError({'error_message':_0x51955f,'error_type':_0x35ae96?_0x205f40(0xd5):_0x352c0e instanceof Error?_0x352c0e[_0x205f40(0x188)][_0x205f40(0xf9)]:_0x205f40(0x161),'context':{'tool':'codebase_search','repo_path':_0x47fb36['data']['repo_path'],'query':_0x47fb36[_0x205f40(0xee)][_0x205f40(0x16e)],'model':'morph-warp-grep-v2.1','is_timeout':_0x35ae96,'exception_phase':_0x205f40(0x186),'request_content':{'query':_0x47fb36[_0x205f40(0xee)][_0x205f40(0x16e)],'repo_path':_0x47fb36[_0x205f40(0xee)]['repo_path'],'repoRoot':a0_0xc22154[_0x205f40(0x98)](_0x47fb36[_0x205f40(0xee)][_0x205f40(0xa4)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x352c0e instanceof Error?_0x352c0e[_0x205f40(0x152)]:undefined,'source':_0x205f40(0xaa)})[_0x205f40(0x145)](()=>{}),{'content':[{'type':_0x205f40(0x166),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x51955f}],'isError':![]};}}case TOOL_NAMES[_0x205f40(0x15f)]:{const _0x334992=WarpGrepGitHubArgsSchema[_0x205f40(0xb1)](_0x1cbe99);if(!_0x334992['success'])return{'content':[{'type':_0x205f40(0x166),'text':_0x205f40(0x139)+_0x334992[_0x205f40(0xd3)]}],'isError':!![]};const _0xe2198f=_0x334992[_0x205f40(0xee)][_0x205f40(0x17b)]||_0x334992[_0x205f40(0xee)][_0x205f40(0x196)];if(!_0xe2198f)return{'content':[{'type':_0x205f40(0x166),'text':_0x205f40(0x16d)}],'isError':!![]};const _0x14c3cf=MORPH_API_KEY;if(!_0x14c3cf)throw new Error(_0x205f40(0x9f));const _0x57f4b2=Date[_0x205f40(0x111)]();logger[_0x205f40(0xd1)](_0x205f40(0x124),_0x205f40(0xab),{'identifier':_0xe2198f,'query':_0x334992[_0x205f40(0xee)][_0x205f40(0x16e)],'branch':_0x334992['data'][_0x205f40(0xb9)]});try{const _0x126017=new WarpGrepClient({'morphApiKey':_0x14c3cf,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x179a72=await _0x126017['searchGitHub']({'searchTerm':_0x334992[_0x205f40(0xee)][_0x205f40(0x16e)],'github':_0xe2198f,'branch':_0x334992[_0x205f40(0xee)][_0x205f40(0xb9)]}),_0x74e2a1=Date['now']()-_0x57f4b2;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x74e2a1+_0x205f40(0x18a)+_0x179a72[_0x205f40(0x12f)]);const _0x4858f7=formatResult(_0x179a72);return{'content':[{'type':'text','text':_0x4858f7}]};}catch(_0x3b769f){const _0x396d28=handleMorphAPIError(_0x3b769f);if(_0x396d28)return _0x396d28;const _0x44736e=Date['now']()-_0x57f4b2,_0x4e6bbe=_0x3b769f instanceof Error?_0x3b769f[_0x205f40(0x14c)]:String(_0x3b769f);return logMcpStderr(_0x205f40(0x123)+_0x44736e+_0x205f40(0xbc),_0x4e6bbe),reportMorphError({'error_message':_0x4e6bbe,'error_type':_0x3b769f instanceof Error?_0x3b769f[_0x205f40(0x188)]['name']:_0x205f40(0x161),'context':{'tool':'github_codebase_search','github_url':_0xe2198f,'search_string':_0x334992['data']['search_string'],'branch':_0x334992[_0x205f40(0xee)]['branch']},'stack_trace':_0x3b769f instanceof Error?_0x3b769f['stack']:undefined,'source':_0x205f40(0xaa),'tool':'github_codebase_search','latency_ms':_0x44736e})[_0x205f40(0x145)](()=>{}),{'content':[{'type':_0x205f40(0x166),'text':_0x205f40(0xb8)+_0x4e6bbe}],'isError':![]};}}default:throw new Error(_0x205f40(0x169)+_0x243636);}}catch(_0x1d13fe){const _0x1a1922=_0x1d13fe instanceof Error?_0x1d13fe[_0x205f40(0x14c)]:String(_0x1d13fe);return reportMorphError({'error_message':_0x1a1922,'error_type':_0x1d13fe instanceof Error?_0x1d13fe[_0x205f40(0x188)][_0x205f40(0xf9)]:_0x205f40(0x161),'context':{'tool':_0x243636,'arguments':_0x1cbe99?JSON['stringify'](_0x1cbe99)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x205f40(0x99)},'stack_trace':_0x1d13fe instanceof Error?_0x1d13fe[_0x205f40(0x152)]:undefined,'source':_0x205f40(0xaa)})[_0x205f40(0x145)](()=>{}),{'content':[{'type':_0x205f40(0x166),'text':_0x205f40(0xfc)+_0x1a1922}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x3b71eb){const _0x4a367f=a0_0x35c683,_0x33820e=await getValidRootDirectories(_0x3b71eb);if(_0x33820e[_0x4a367f(0xa8)]>0x0)allowedDirectories=[..._0x33820e],logMcpStderr(_0x4a367f(0x164)+_0x33820e['length']+'\x20valid\x20directories');else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x2b7bcd=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x2b7bcd&&(allowedDirectories=[_0x2b7bcd],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x2b7bcd));}catch(_0x1ceeb1){logMcpStderr(_0x4a367f(0x1a6)+_0x1ceeb1);}}}server[a0_0x35c683(0xef)](RootsListChangedNotificationSchema,async()=>{const _0x55bdfe=a0_0x35c683;try{const _0x1b1916=await server[_0x55bdfe(0x149)]();_0x1b1916&&'roots'in _0x1b1916&&await updateAllowedDirectoriesFromRoots(_0x1b1916[_0x55bdfe(0xe7)]);}catch(_0x40b5b5){logMcpStderr(_0x55bdfe(0x168),_0x40b5b5 instanceof Error?_0x40b5b5[_0x55bdfe(0x14c)]:String(_0x40b5b5));}}),server[a0_0x35c683(0x181)]=async()=>{const _0x5adac1=a0_0x35c683,_0x3deb55=server[_0x5adac1(0x10f)]();if(_0x3deb55?.[_0x5adac1(0xe7)])try{const _0x4ec39f=await server[_0x5adac1(0x149)]();_0x4ec39f&&_0x5adac1(0xe7)in _0x4ec39f?await updateAllowedDirectoriesFromRoots(_0x4ec39f[_0x5adac1(0xe7)]):logMcpStderr(_0x5adac1(0xb7));}catch(_0x1449e7){logMcpStderr(_0x5adac1(0xb2),_0x1449e7 instanceof Error?_0x1449e7[_0x5adac1(0x14c)]:String(_0x1449e7));}else{if(allowedDirectories[_0x5adac1(0xa8)]>0x0)logMcpStderr(_0x5adac1(0x8e),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x5adac1(0x19b));else throw new Error(_0x5adac1(0x95));}}};async function runServer(){const _0x2d3a88=a0_0x35c683,_0x1469c5=new StdioServerTransport();await server[_0x2d3a88(0xc6)](_0x1469c5),logMcpStderr(_0x2d3a88(0xc7)),allowedDirectories['length']===0x0&&logMcpStderr(_0x2d3a88(0x10e));}runServer()[a0_0x35c683(0x145)](_0x128ef5=>{const _0x5d64a1=a0_0x35c683;logMcpStderr(_0x5d64a1(0x170),_0x128ef5),process[_0x5d64a1(0x146)](0x1);});
|
package/dist/log-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a1_0x9e9d41=a1_0x42f8;(function(_0x77aeda,_0x52d16c){var _0x1758ea=a1_0x42f8,_0xc79968=_0x77aeda();while(!![]){try{var _0xb7e542=-parseInt(_0x1758ea(0xc5))/0x1+parseInt(_0x1758ea(0xba))/0x2+parseInt(_0x1758ea(0xca))/0x3*(-parseInt(_0x1758ea(0xc4))/0x4)+-parseInt(_0x1758ea(0xbf))/0x5*(-parseInt(_0x1758ea(0xcc))/0x6)+-parseInt(_0x1758ea(0xbe))/0x7+-parseInt(_0x1758ea(0xc6))/0x8*(parseInt(_0x1758ea(0xc1))/0x9)+parseInt(_0x1758ea(0xbb))/0xa;if(_0xb7e542===_0x52d16c)break;else _0xc79968['push'](_0xc79968['shift']());}catch(_0x27b912){_0xc79968['push'](_0xc79968['shift']());}}}(a1_0x4713,0xe6986));import a1_0x2e45e6 from'os';function a1_0x4713(){var _0x416c83=['290322TaLFFd','darwin','2526HzchDS','1949290oICVLb','16661040VQAVeC','error','platform','4785543zHvoux','18415EsDBQK','Windows','45Uqpaen','info','macOS','60wkTlbE','75380CcVFSW','1657816khRehB','map','[os=','Linux'];a1_0x4713=function(){return _0x416c83;};return a1_0x4713();}import{logger}from'./logger.js';export function getOperatingSystemType(_0x25c5c5=a1_0x2e45e6[a1_0x9e9d41(0xbd)]()){var _0x5d7ecb=a1_0x9e9d41;switch(_0x25c5c5){case _0x5d7ecb(0xcb):return _0x5d7ecb(0xc3);case'win32':return _0x5d7ecb(0xc0);case'linux':return _0x5d7ecb(0xc9);default:return'Unknown';}}function a1_0x42f8(_0x496579,_0x1dbab7){_0x496579=_0x496579-0xba;var _0x4713d4=a1_0x4713();var _0x42f840=_0x4713d4[_0x496579];return _0x42f840;}export function formatMcpLogMessage(_0x27f14a,_0x410df7=a1_0x2e45e6[a1_0x9e9d41(0xbd)]()){var _0x1e7539=a1_0x9e9d41;return _0x1e7539(0xc8)+getOperatingSystemType(_0x410df7)+']\x20'+_0x27f14a;}export function logMcpStderr(_0x18f309,..._0x4781f6){var _0x313f80=a1_0x9e9d41;console[_0x313f80(0xbc)](formatMcpLogMessage(_0x18f309),..._0x4781f6),logger[_0x313f80(0xc2)]('MCP',_0x18f309,_0x4781f6['length']?{'args':_0x4781f6[_0x313f80(0xc7)](_0x36b987=>String(_0x36b987))}:undefined);}
|
package/dist/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a2_0x215def=a2_0x3426;(function(_0x3f0f0a,_0x2a31de){const _0x29f835=a2_0x3426,_0x4bde9b=_0x3f0f0a();while(!![]){try{const _0x344b7e=-parseInt(_0x29f835(0x118))/0x1*(-parseInt(_0x29f835(0x110))/0x2)+-parseInt(_0x29f835(0x111))/0x3*(parseInt(_0x29f835(0x11a))/0x4)+parseInt(_0x29f835(0x10c))/0x5*(parseInt(_0x29f835(0x10e))/0x6)+-parseInt(_0x29f835(0x124))/0x7*(parseInt(_0x29f835(0x113))/0x8)+-parseInt(_0x29f835(0x127))/0x9*(-parseInt(_0x29f835(0x119))/0xa)+parseInt(_0x29f835(0x11e))/0xb+-parseInt(_0x29f835(0x125))/0xc;if(_0x344b7e===_0x2a31de)break;else _0x4bde9b['push'](_0x4bde9b['shift']());}catch(_0x59a12a){_0x4bde9b['push'](_0x4bde9b['shift']());}}}(a2_0x1c52,0x550ff));import{createWriteStream}from'fs';class MorphLogger{['enabled'];['fileStream'];constructor(){const _0x7f90e1=a2_0x3426;this[_0x7f90e1(0x123)]=process[_0x7f90e1(0x117)][_0x7f90e1(0x112)]==='1'||!!process[_0x7f90e1(0x117)][_0x7f90e1(0x10f)];const _0x2fd895=process[_0x7f90e1(0x117)][_0x7f90e1(0x10f)];this[_0x7f90e1(0x126)]=_0x2fd895?createWriteStream(_0x2fd895,{'flags':'a'}):null;}['debug'](_0x3dc8a9,_0x2d818c,_0x1f539c){const _0x32082f=a2_0x3426;this['_log'](_0x32082f(0x121),_0x3dc8a9,_0x2d818c,_0x1f539c);}['info'](_0x606037,_0x133118,_0x11b595){const _0x999264=a2_0x3426;this[_0x999264(0x10d)](_0x999264(0x120),_0x606037,_0x133118,_0x11b595);}['warn'](_0x2445e6,_0x5af8b0,_0x43dea3){const _0x1cd0a2=a2_0x3426;this[_0x1cd0a2(0x10d)](_0x1cd0a2(0x114),_0x2445e6,_0x5af8b0,_0x43dea3);}[a2_0x215def(0x122)](_0x8b7b53,_0x4712f3,_0x539ef0){const _0x487cff=a2_0x215def;this['_log'](_0x487cff(0x122),_0x8b7b53,_0x4712f3,_0x539ef0);}[a2_0x215def(0x115)](){const _0x587d3d=a2_0x215def;this[_0x587d3d(0x123)]=!![];}get[a2_0x215def(0x128)](){const _0x46693f=a2_0x215def;return this[_0x46693f(0x123)];}[a2_0x215def(0x10d)](_0x4da416,_0x457244,_0x1fa665,_0x288bb8){const _0x24f44b=a2_0x215def;if(_0x4da416!==_0x24f44b(0x122)&&!this[_0x24f44b(0x123)])return;const _0x4a5958=new Date()[_0x24f44b(0x11b)](),_0x58ed0c='['+_0x4a5958+']\x20['+_0x4da416[_0x24f44b(0x11f)]()+_0x24f44b(0x116)+_0x457244+']';console[_0x24f44b(0x122)](_0x288bb8?_0x58ed0c+'\x20'+_0x1fa665+'\x20'+JSON[_0x24f44b(0x11d)](_0x288bb8):_0x58ed0c+'\x20'+_0x1fa665),this[_0x24f44b(0x126)]?.[_0x24f44b(0x11c)](JSON[_0x24f44b(0x11d)]({'ts':_0x4a5958,'level':_0x4da416,'component':_0x457244,'msg':_0x1fa665,..._0x288bb8&&{'data':_0x288bb8}})+'\x0a');}}export const logger=new MorphLogger();function a2_0x3426(_0x2a6b64,_0x4a409a){_0x2a6b64=_0x2a6b64-0x10c;const _0x1c52b2=a2_0x1c52();let _0x34267f=_0x1c52b2[_0x2a6b64];return _0x34267f;}function a2_0x1c52(){const _0x39d24e=['335868rhjDCZ','toISOString','write','stringify','6080734VMIuvP','toUpperCase','info','debug','error','enabled','7791MyFbcW','12575436ybCrQj','fileStream','1394397UpMQHL','isEnabled','490MdWhao','_log','14646ManxDQ','MORPH_LOG_FILE','102PHPybF','6WaHlos','MORPH_DEBUG','600JdaMBA','warn','enable',']\x20[','env','7666egnnlx','30OkkKTx'];a2_0x1c52=function(){return _0x39d24e;};return a2_0x1c52();}
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a3_0x277e(){const _0x3fb94f=['208WtarPq','test','2aCooOp','toUpperCase','3ppBcBE','6399107RIOJNz','replace','567765TyHNSz','/mnt/','join','2407391pClvig','241373ILnKRR','startsWith','trim','substring','normalize','charAt','match','6SxDlDU','32688eZimMX','2438780CNZRUk','slice','134308XUfAtX'];a3_0x277e=function(){return _0x3fb94f;};return a3_0x277e();}(function(_0x39f75c,_0x492b72){const _0x1878ab=a3_0x46fc,_0x1c32ca=_0x39f75c();while(!![]){try{const _0x1054aa=parseInt(_0x1878ab(0x135))/0x1*(parseInt(_0x1878ab(0x12c))/0x2)+parseInt(_0x1878ab(0x12e))/0x3*(-parseInt(_0x1878ab(0x129))/0x4)+-parseInt(_0x1878ab(0x131))/0x5+parseInt(_0x1878ab(0x13c))/0x6*(parseInt(_0x1878ab(0x134))/0x7)+parseInt(_0x1878ab(0x12a))/0x8*(parseInt(_0x1878ab(0x13d))/0x9)+parseInt(_0x1878ab(0x127))/0xa+-parseInt(_0x1878ab(0x12f))/0xb;if(_0x1054aa===_0x492b72)break;else _0x1c32ca['push'](_0x1c32ca['shift']());}catch(_0x386873){_0x1c32ca['push'](_0x1c32ca['shift']());}}}(a3_0x277e,0x2f8a9));import a3_0x11ab78 from'path';import a3_0x157bc5 from'os';export function convertToWindowsPath(_0x4e34f5){const _0x3adfa7=a3_0x46fc;if(_0x4e34f5[_0x3adfa7(0x136)](_0x3adfa7(0x132))){const _0x4c686e=_0x4e34f5[_0x3adfa7(0x13a)](0x5)['toUpperCase'](),_0x152cae=_0x4e34f5[_0x3adfa7(0x128)](0x6)[_0x3adfa7(0x130)](/\//g,'\x5c');return _0x4c686e+':'+_0x152cae;}if(_0x4e34f5[_0x3adfa7(0x13b)](/^\/[a-zA-Z]\//)){const _0x5bae41=_0x4e34f5[_0x3adfa7(0x13a)](0x1)[_0x3adfa7(0x12d)](),_0x4aaa5c=_0x4e34f5[_0x3adfa7(0x128)](0x2)[_0x3adfa7(0x130)](/\//g,'\x5c');return _0x5bae41+':'+_0x4aaa5c;}if(_0x4e34f5[_0x3adfa7(0x13b)](/^[a-zA-Z]:/))return _0x4e34f5[_0x3adfa7(0x130)](/\//g,'\x5c');return _0x4e34f5;}export function normalizePath(_0x14dbad){const _0x1659b4=a3_0x46fc;_0x14dbad=_0x14dbad[_0x1659b4(0x137)]()[_0x1659b4(0x130)](/^["']|["']$/g,'');const _0x2e637f=_0x14dbad[_0x1659b4(0x136)]('/')&&!_0x14dbad[_0x1659b4(0x13b)](/^\/mnt\/[a-z]\//i)&&!_0x14dbad[_0x1659b4(0x13b)](/^\/[a-zA-Z]\//);if(_0x2e637f)return _0x14dbad[_0x1659b4(0x130)](/\/+/g,'/')[_0x1659b4(0x130)](/\/+$/,'');_0x14dbad=convertToWindowsPath(_0x14dbad);if(_0x14dbad[_0x1659b4(0x136)]('\x5c\x5c')){let _0x13fd94=_0x14dbad;_0x13fd94=_0x13fd94['replace'](/^\\{2,}/,'\x5c\x5c');const _0x1d613a=_0x13fd94[_0x1659b4(0x138)](0x2)['replace'](/\\\\/g,'\x5c');_0x14dbad='\x5c\x5c'+_0x1d613a;}else _0x14dbad=_0x14dbad['replace'](/\\\\/g,'\x5c');let _0x3f0b35=a3_0x11ab78[_0x1659b4(0x139)](_0x14dbad);_0x14dbad[_0x1659b4(0x136)]('\x5c\x5c')&&!_0x3f0b35['startsWith']('\x5c\x5c')&&(_0x3f0b35='\x5c'+_0x3f0b35);if(_0x3f0b35['match'](/^[a-zA-Z]:/)){let _0x219212=_0x3f0b35[_0x1659b4(0x130)](/\//g,'\x5c');return/^[a-z]:/[_0x1659b4(0x12b)](_0x219212)&&(_0x219212=_0x219212[_0x1659b4(0x13a)](0x0)[_0x1659b4(0x12d)]()+_0x219212[_0x1659b4(0x128)](0x1)),_0x219212;}return _0x3f0b35[_0x1659b4(0x130)](/\//g,'\x5c');}function a3_0x46fc(_0x5da4e0,_0x3eefa0){_0x5da4e0=_0x5da4e0-0x127;const _0x277ed3=a3_0x277e();let _0x46fcef=_0x277ed3[_0x5da4e0];return _0x46fcef;}export function expandHome(_0x2b0ac4){const _0x107c43=a3_0x46fc;if(_0x2b0ac4[_0x107c43(0x136)]('~/')||_0x2b0ac4==='~')return a3_0x11ab78[_0x107c43(0x133)](a3_0x157bc5['homedir'](),_0x2b0ac4[_0x107c43(0x128)](0x1));return _0x2b0ac4;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x12f0ef,_0x5e2829){const _0x117072=a4_0x543f,_0x3ef89c=_0x12f0ef();while(!![]){try{const _0x5b6848=-parseInt(_0x117072(0xf3))/0x1+parseInt(_0x117072(0xf9))/0x2+parseInt(_0x117072(0xf6))/0x3*(parseInt(_0x117072(0xfe))/0x4)+parseInt(_0x117072(0xf4))/0x5+parseInt(_0x117072(0xf0))/0x6+parseInt(_0x117072(0xfc))/0x7+-parseInt(_0x117072(0x100))/0x8*(parseInt(_0x117072(0xfa))/0x9);if(_0x5b6848===_0x5e2829)break;else _0x3ef89c['push'](_0x3ef89c['shift']());}catch(_0x2df95e){_0x3ef89c['push'](_0x3ef89c['shift']());}}}(a4_0x1786,0x77704));import a4_0x5dcf24 from'path';function a4_0x1786(){const _0x268613=['2745030wrayGq','resolve','Path\x20must\x20be\x20absolute\x20after\x20normalization','297537BGfaFQ','3229285FCdqNQ','normalize','3YrLCgP','some','isAbsolute','567948vMDpOi','9XHIPzD','includes','937125yaevbs','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','1994444PCHNux','length','9864520orzWNX','startsWith','sep','isArray','string'];a4_0x1786=function(){return _0x268613;};return a4_0x1786();}function a4_0x543f(_0x325915,_0x13befd){_0x325915=_0x325915-0xed;const _0x1786b7=a4_0x1786();let _0x543fe3=_0x1786b7[_0x325915];return _0x543fe3;}export function isPathWithinAllowedDirectories(_0x3419b3,_0x4b8497){const _0x141e66=a4_0x543f;if(typeof _0x3419b3!==_0x141e66(0xef)||!Array[_0x141e66(0xee)](_0x4b8497))return![];if(!_0x3419b3||_0x4b8497[_0x141e66(0xff)]===0x0)return![];if(_0x3419b3[_0x141e66(0xfb)]('\x00'))return![];let _0x357e4e;try{_0x357e4e=a4_0x5dcf24[_0x141e66(0xf1)](a4_0x5dcf24[_0x141e66(0xf5)](_0x3419b3));}catch{return![];}if(!a4_0x5dcf24[_0x141e66(0xf8)](_0x357e4e))throw new Error(_0x141e66(0xf2));return _0x4b8497[_0x141e66(0xf7)](_0x4ea803=>{const _0x50816c=_0x141e66;if(typeof _0x4ea803!==_0x50816c(0xef)||!_0x4ea803)return![];if(_0x4ea803[_0x50816c(0xfb)]('\x00'))return![];let _0x28b74b;try{_0x28b74b=a4_0x5dcf24[_0x50816c(0xf1)](a4_0x5dcf24[_0x50816c(0xf5)](_0x4ea803));}catch{return![];}if(!a4_0x5dcf24[_0x50816c(0xf8)](_0x28b74b))throw new Error(_0x50816c(0xfd));if(_0x357e4e===_0x28b74b)return!![];if(_0x28b74b===a4_0x5dcf24[_0x50816c(0xed)])return _0x357e4e[_0x50816c(0x101)](a4_0x5dcf24[_0x50816c(0xed)]);return _0x357e4e[_0x50816c(0x101)](_0x28b74b+a4_0x5dcf24['sep']);});}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x23c647,_0x31536c){const _0x4eb347=a5_0x5f53,_0x4847f4=_0x23c647();while(!![]){try{const _0x2568bf=parseInt(_0x4eb347(0x150))/0x1+-parseInt(_0x4eb347(0x144))/0x2+-parseInt(_0x4eb347(0x13b))/0x3*(-parseInt(_0x4eb347(0x140))/0x4)+-parseInt(_0x4eb347(0x13e))/0x5+-parseInt(_0x4eb347(0x14c))/0x6+parseInt(_0x4eb347(0x14b))/0x7+-parseInt(_0x4eb347(0x145))/0x8*(-parseInt(_0x4eb347(0x146))/0x9);if(_0x2568bf===_0x31536c)break;else _0x4847f4['push'](_0x4847f4['shift']());}catch(_0x28ed4f){_0x4847f4['push'](_0x4847f4['shift']());}}}(a5_0x50bb,0xc594e));import{promises as a5_0x141678}from'fs';import a5_0xa03332 from'path';import a5_0xcb3c21 from'os';function a5_0x5f53(_0x500309,_0x118d81){_0x500309=_0x500309-0x13b;const _0x50bbce=a5_0x50bb();let _0x5f53f6=_0x50bbce[_0x500309];return _0x5f53f6;}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x407a50){const _0xea8950=a5_0x5f53;try{const _0x5095b4=_0x407a50[_0xea8950(0x13f)](_0xea8950(0x141))?_0x407a50[_0xea8950(0x14a)](0x7):_0x407a50,_0x36d311=_0x5095b4[_0xea8950(0x13f)]('~/')||_0x5095b4==='~'?a5_0xa03332[_0xea8950(0x14f)](a5_0xcb3c21[_0xea8950(0x151)](),_0x5095b4[_0xea8950(0x14a)](0x1)):_0x5095b4,_0x227b5e=a5_0xa03332[_0xea8950(0x149)](_0x36d311),_0x262c40=await a5_0x141678['realpath'](_0x227b5e);return normalizePath(_0x262c40);}catch{return null;}}function formatDirectoryError(_0xc290f1,_0x1142a7,_0x53461f){const _0x419ca7=a5_0x5f53;if(_0x53461f)return _0x419ca7(0x143)+_0x53461f+':\x20'+_0xc290f1;const _0x1bd426=_0x1142a7 instanceof Error?_0x1142a7[_0x419ca7(0x14d)]:String(_0x1142a7);return _0x419ca7(0x142)+_0xc290f1+'\x20due\x20to\x20error:\x20'+_0x1bd426;}export async function getValidRootDirectories(_0x2fbefc){const _0x4e6e3e=a5_0x5f53,_0x514388=[];for(const _0x3397c7 of _0x2fbefc){const _0x4303ed=await parseRootUri(_0x3397c7[_0x4e6e3e(0x148)]);if(!_0x4303ed){logMcpStderr(formatDirectoryError(_0x3397c7[_0x4e6e3e(0x148)],undefined,_0x4e6e3e(0x13d)));continue;}try{const _0x453fd0=await a5_0x141678[_0x4e6e3e(0x13c)](_0x4303ed);_0x453fd0[_0x4e6e3e(0x14e)]()?_0x514388[_0x4e6e3e(0x147)](_0x4303ed):logMcpStderr(formatDirectoryError(_0x4303ed,undefined,'non-directory\x20root'));}catch(_0x594c0e){logMcpStderr(formatDirectoryError(_0x4303ed,_0x594c0e));}}return _0x514388;}function a5_0x50bb(){const _0xfce959=['file://','Skipping\x20invalid\x20directory:\x20','Skipping\x20','2849466lnnxeR','56gyeNfw','1822977xorLiT','push','uri','resolve','slice','6149724cOccKZ','2367708uSafsQ','message','isDirectory','join','656314MMQtOu','homedir','751149bRwGdH','stat','invalid\x20path\x20or\x20inaccessible','2872275vJgWTC','startsWith','4VTVpkP'];a5_0x50bb=function(){return _0xfce959;};return a5_0x50bb();}
|
package/dist/tool-definitions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a6_0x447336=a6_0xeca3;(function(_0x349986,_0x216409){const _0x47c238=a6_0xeca3,_0x5ebc90=_0x349986();while(!![]){try{const _0x3f2bcc=parseInt(_0x47c238(0xc8))/0x1+-parseInt(_0x47c238(0xc7))/0x2*(-parseInt(_0x47c238(0xce))/0x3)+-parseInt(_0x47c238(0xc6))/0x4*(parseInt(_0x47c238(0xc5))/0x5)+parseInt(_0x47c238(0xd1))/0x6*(-parseInt(_0x47c238(0xcb))/0x7)+-parseInt(_0x47c238(0xc4))/0x8*(parseInt(_0x47c238(0xcf))/0x9)+-parseInt(_0x47c238(0xc9))/0xa*(parseInt(_0x47c238(0xcc))/0xb)+parseInt(_0x47c238(0xca))/0xc;if(_0x3f2bcc===_0x216409)break;else _0x5ebc90['push'](_0x5ebc90['shift']());}catch(_0x525750){_0x5ebc90['push'](_0x5ebc90['shift']());}}}(a6_0xc5eb,0x58dcf));export const TOOL_NAMES={'EDIT_FILE':a6_0x447336(0xd2),'CODEBASE_SEARCH':a6_0x447336(0xcd),'GITHUB_CODEBASE_SEARCH':a6_0x447336(0xd0)};function a6_0xeca3(_0x531dfc,_0x4afbe4){_0x531dfc=_0x531dfc-0xc4;const _0xc5ebe9=a6_0xc5eb();let _0xeca30a=_0xc5ebe9[_0x531dfc];return _0xeca30a;}export const ALL_TOOL_NAMES=Object['values'](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);function a6_0xc5eb(){const _0x315682=['429411KCtRUq','63ecLXgw','github_codebase_search','12SiHJmI','edit_file','649432hcDNuk','5fHtoNe','49924lPRfnB','10igoZgi','707231TxVyIH','2011930pTKkpV','4093608aYzYTC','2163490RoAopr','11ZkPdgT','codebase_search'];a6_0xc5eb=function(){return _0x315682;};return a6_0xc5eb();}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.185",
|
|
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.175",
|
|
39
39
|
"@vscode/ripgrep": "^1.15.14",
|
|
40
40
|
"axios": "^1.6.0",
|
|
41
41
|
"chalk": "^5.3.0",
|