@morphllm/morphmcp 0.8.196 → 0.8.197
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_0x525535=a0_0x4b31;(function(_0x3f2428,_0x129863){const _0x3ee4e4=a0_0x4b31,_0x11ae3e=_0x3f2428();while(!![]){try{const _0x120332=parseInt(_0x3ee4e4(0x25f))/0x1*(parseInt(_0x3ee4e4(0x152))/0x2)+-parseInt(_0x3ee4e4(0x26f))/0x3+-parseInt(_0x3ee4e4(0x1c8))/0x4*(-parseInt(_0x3ee4e4(0x1ae))/0x5)+-parseInt(_0x3ee4e4(0x157))/0x6*(parseInt(_0x3ee4e4(0x236))/0x7)+-parseInt(_0x3ee4e4(0x1dc))/0x8+parseInt(_0x3ee4e4(0x275))/0x9*(-parseInt(_0x3ee4e4(0x1ec))/0xa)+parseInt(_0x3ee4e4(0x197))/0xb*(parseInt(_0x3ee4e4(0x150))/0xc);if(_0x120332===_0x129863)break;else _0x11ae3e['push'](_0x11ae3e['shift']());}catch(_0x585d19){_0x11ae3e['push'](_0x11ae3e['shift']());}}}(a0_0x2805,0x76da9));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_0x4128a0 from'fs/promises';import a0_0x368898 from'path';import a0_0x55064c 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_0x598df from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x35a4c3){const _0x97e2d0=a0_0x4b31,_0x5d759e=_0x35a4c3[_0x97e2d0(0x253)](a0_0x368898[_0x97e2d0(0x1b8)])['filter'](Boolean);if(_0x5d759e[_0x97e2d0(0x1b2)]<0x2)return null;for(let _0x2beec2=Math[_0x97e2d0(0x158)](_0x5d759e[_0x97e2d0(0x1b2)]/0x2);_0x2beec2>=0x1;_0x2beec2--){for(let _0x32e744=0x0;_0x32e744<=_0x5d759e[_0x97e2d0(0x1b2)]-0x2*_0x2beec2;_0x32e744++){const _0x48946c=_0x5d759e[_0x97e2d0(0x1bf)](_0x32e744,_0x32e744+_0x2beec2),_0x1f68ee=_0x5d759e[_0x97e2d0(0x1bf)](_0x32e744+_0x2beec2,_0x32e744+0x2*_0x2beec2);if(_0x48946c['every']((_0x50444a,_0x45f659)=>_0x50444a===_0x1f68ee[_0x45f659])){const _0x2031f4=[..._0x5d759e[_0x97e2d0(0x1bf)](0x0,_0x32e744),..._0x5d759e[_0x97e2d0(0x1bf)](_0x32e744+_0x2beec2)];return a0_0x368898[_0x97e2d0(0x1b8)]+_0x2031f4[_0x97e2d0(0x25b)](a0_0x368898[_0x97e2d0(0x1b8)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0xec0b91=a0_0x4b31;try{const _0x30d7ab=require(_0xec0b91(0x23c));return _0x30d7ab[_0xec0b91(0x24c)]??_0xec0b91(0x199);}catch(_0x3f3593){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x3f3593),_0xec0b91(0x199);}}function printHelp(){const _0x1bdc9c=a0_0x4b31;console[_0x1bdc9c(0x1c3)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x1bdc9c(0x1c3)](_0x1bdc9c(0x1cc)),console[_0x1bdc9c(0x1c3)](_0x1bdc9c(0x15c)),console['log'](_0x1bdc9c(0x1cd)),console[_0x1bdc9c(0x1c3)](_0x1bdc9c(0x1bd)),console[_0x1bdc9c(0x1c3)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x1bdc9c(0x1c3)](_0x1bdc9c(0x189)),console[_0x1bdc9c(0x1c3)]('\x20\x20morph-mcp'),console['log']('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process[a0_0x525535(0x1ee)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x525535(0x181),'-v','-V']),HELP_FLAGS=new Set([a0_0x525535(0x18f),'-h']);cliArgs[a0_0x525535(0x26d)](_0x1408e7=>VERSION_FLAGS['has'](_0x1408e7))&&(console[a0_0x525535(0x1c3)](a0_0x525535(0x271)+getPackageVersion()),process[a0_0x525535(0x1d8)](0x0));cliArgs[a0_0x525535(0x26d)](_0x60b7b6=>HELP_FLAGS[a0_0x525535(0x187)](_0x60b7b6))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x2bfa02){const _0xa5613e=a0_0x525535;for(let _0x55de95=0x0;_0x55de95<cliArgs['length'];_0x55de95++){const _0x5ee86d=cliArgs[_0x55de95];if(_0x5ee86d[_0xa5613e(0x1c9)]('--'+_0x2bfa02+'='))return _0x5ee86d[_0xa5613e(0x1bf)](('--'+_0x2bfa02+'=')[_0xa5613e(0x1b2)]);if(_0x5ee86d==='--'+_0x2bfa02&&_0x55de95+0x1<cliArgs[_0xa5613e(0x1b2)])return cliArgs[_0x55de95+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x525535(0x1b2)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x525535(0x187)](arg)||HELP_FLAGS[a0_0x525535(0x187)](arg))continue;if(arg[a0_0x525535(0x1c9)](a0_0x525535(0x20b)))continue;if(arg===a0_0x525535(0x1e2)){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x525535(0x1d2)][a0_0x525535(0x21d)]||process[a0_0x525535(0x1d2)]['PWD']||process[a0_0x525535(0x1ad)](),ENABLE_WORKSPACE_MODE=process[a0_0x525535(0x1d2)]['ENABLE_WORKSPACE_MODE']!==a0_0x525535(0x1c2),MORPH_API_KEY=getCliArg('api-key')??process[a0_0x525535(0x1d2)][a0_0x525535(0x25c)],MORPH_API_URL=process['env']['MORPH_API_URL'],MORPH_LARGE_APPLY=process[a0_0x525535(0x1d2)][a0_0x525535(0x215)]!==a0_0x525535(0x1c2),MORPH_WARP_GREP_TIMEOUT=process[a0_0x525535(0x1d2)][a0_0x525535(0x22b)]?parseInt(process['env']['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x525535(0x1d2)][a0_0x525535(0x1e5)]?new Set(process['env'][a0_0x525535(0x1e5)][a0_0x525535(0x253)](',')[a0_0x525535(0x1bb)](_0x1ff9f5=>_0x1ff9f5[a0_0x525535(0x237)]())[a0_0x525535(0x1c7)](_0x154417=>_0x154417[a0_0x525535(0x1b2)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x525535(0x1f1)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x525535(0x187)](tool)&&console[a0_0x525535(0x225)](a0_0x525535(0x244)+tool+a0_0x525535(0x23d)+[...KNOWN_TOOL_NAMES][a0_0x525535(0x25b)](',\x20'));}console[a0_0x525535(0x225)](a0_0x525535(0x19c)+[...DISABLED_TOOLS][a0_0x525535(0x25b)](',\x20'));}function a0_0x4b31(_0x27aa1a,_0x2b0f35){_0x27aa1a=_0x27aa1a-0x14f;const _0x2805c9=a0_0x2805();let _0x4b3180=_0x2805c9[_0x27aa1a];return _0x4b3180;}function a0_0x2805(){const _0x5685ff=['normalize','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','default','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.','role','unknown\x20error','file','\x20as\x20allowed\x20directory','mcp-filesystem','api_request_start','min','completed','now','etimedout','Here\x20is\x20the\x20content\x20of\x20files:\x0a','<file\x20path=\x22','-\x20Read\x20file\x20`','--version','ToolException','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','array','glob','tool','has','read\x20','\x0aExamples:','toISOString','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','Bearer\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','Tool\x20','--help','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','timeout','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','morph-warp-grep-v2.1','Unknown\x20tool:\x20','Fatal\x20error\x20running\x20server:','stringify','193017TfTZPQ','Tool\x20\x22','unknown','TimeoutError','changes','Disabled\x20tools:\x20','morph-v3-large','Morph\x20Edit\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','string','path_validation_resolved','tool_call_error','.\x20Path:\x20','\x0a...\x20(truncated,\x20total:\x20','UnknownError','**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','Error:\x20','Authentication\x20failed:\x20Your\x20Morph\x20API\x20key\x20is\x20invalid\x20or\x20has\x20been\x20revoked.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key,\x20then\x20update\x20your\x20MCP\x20configuration.','Warning:\x20','BinaryFile','describe','cwd','2461210jmEfBv','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','user','file_read_complete','length','-\x20Preserve\x20exact\x20indentation\x0a','MCP','SymlinkError','success','timings','sep','.cursor','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','map','dryRun','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','0.2.0','slice','\x20valid\x20directories','code','false','log','search_type','ReadError','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','filter','4FikJNP','startsWith','Morph\x20FastApply\x20failed\x20without\x20error\x20message','match','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','instructions','Invalid\x20arguments:\x20','searchGitHub','function','env','isArray','Specific\x20commit\x20hash\x20to\x20search','linesRemoved','terminationReason','\x20(new\x20file)','exit','grep','text','pyproject.toml','1450440TxwPhD','go.mod','includes','lines','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','[github_codebase_search]\x20Done\x20in\x20','--api-key','tool_call_id','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','DISABLED_TOOLS','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','metadata','safeParse','morph-v3-fast','listRoots','RipgrepNotAvailable','1970ElHsHK','https://morphllm.com/api/error-report','argv','.git','read','size','enum','number',',\x20removed\x20','turns','Warning:\x20Workspace\x20fallback\x20failed:\x20','Preview\x20changes\x20without\x20applying\x20them.','push','setRequestHandler','list_directory\x20','Unknown\x20error','instruction','warp_grep_start','morph-mcp','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','sk-','debug','github_url','code_edit','path_validation_failed','package.json','linesModified','terminated','optional','ms:','WarpGrepError','--api-key=','payload','oninitialized','Error\x20accessing\x20directory\x20','\x27\x20in\x20`','.\x20Changes:\x20','parse','search_string','realpath','path_validation_start','MORPH_LARGE_APPLY','\x0a</file>','codebase_search','runWarpGrep_call','roots','.vscode','status','morph-','WORKSPACE_ROOT','content','repo_path','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','new_string','name','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','target_filepath','error','Fallback:\x20Using\x20workspace\x20root\x20','tool_calls','arguments','isDirectory','message','MORPH_WARP_GREP_TIMEOUT','object','-\x20Grepped\x20\x27','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','RipgrepError','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.','all','-\x20Glob\x20search\x20`','Created\x20File','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','File\x20read\x20error:','21YdTWKp','trim','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','grep_search','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','../package.json','\x22.\x20Known\x20tools:\x20','Cargo.toml','filePath','readFile','owner_repo','GitHub\x20search\x20failed:\x20','constructor','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','grep\x20\x27','\x20disabled\x20via\x20DISABLED_TOOLS','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','source','EDIT_FILE','node_modules','substring','version','edit','ms.\x20Success:\x20','file_path','Workspace\x20mode\x20enabled:\x20Using\x20','composer.json','errors','split','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Relevant\x20context\x20found:','finish','command','Parameters:\x0a','CODEBASE_SEARCH','timed\x20out','join','MORPH_API_KEY','toLowerCase','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','176138mqauNo','ENOENT','catch','warn','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','stack','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','pattern','getClientCapabilities','added\x20','dirname','\x20-\x20','boolean','params','some','edit_file','60888OcpUYh','\x20is\x20not\x20a\x20directory','@morphllm/morphmcp\x20','data','files','context','33507seOadF','\x20error(s)','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','828FAtKhW','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','2GZEBjX','github_codebase_search','description','messages','\x22>\x0a','914532lCgqQo','floor','branch','completionId','assistant','\x0aOptions:','utf-8','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','-\x20Listed\x20directory\x20`','LocalRipgrepProvider','Applied','resolve','API\x20error\x20(auth/rate-limit)','indexOf','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','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.','\x20chars)','path','glob\x20\x27','response','❌\x20Morph\x20Edit\x20Failed:\x20','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','`\x20in\x20`','[could\x20not\x20read\x20file:\x20'];a0_0x2805=function(){return _0x5685ff;};return a0_0x2805();}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x525535(0x1c9)](a0_0x525535(0x200))&&!MORPH_API_KEY[a0_0x525535(0x1c9)]('morph-')&&logMcpStderr(a0_0x525535(0x151));async function reportMorphError(_0x47ead2){const _0x41f676=a0_0x525535;try{await a0_0x598df['post'](_0x41f676(0x1ed),{..._0x47ead2,'timestamp':new Date()[_0x41f676(0x18a)](),'source':_0x47ead2['source']||_0x41f676(0x178),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x47ead2[_0x41f676(0x274)]}},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x41f676(0x18c)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x2eaf42,_0xe11803){const _0x13b306=a0_0x525535;if(_0x2eaf42&&typeof _0x2eaf42===_0x13b306(0x22c)&&'status'in _0x2eaf42)return _0x2eaf42[_0x13b306(0x21b)];if(_0x2eaf42&&typeof _0x2eaf42===_0x13b306(0x22c)&&_0x13b306(0x16a)in _0x2eaf42)return _0x2eaf42['response']?.['status'];const _0xba1d84=_0xe11803[_0x13b306(0x1cb)](/\b(401|429)\b/);return _0xba1d84?parseInt(_0xba1d84[0x1],0xa):null;}function handleMorphAPIError(_0x7c5507){const _0x2fdf45=a0_0x525535,_0x5dcfac=_0x7c5507 instanceof Error?_0x7c5507['message']:String(_0x7c5507),_0x2d3de8=extractStatusCode(_0x7c5507,_0x5dcfac);switch(_0x2d3de8){case 0x191:return{'content':[{'type':'text','text':_0x2fdf45(0x1a9)}],'isError':!![]};case 0x1ad:return{'content':[{'type':'text','text':_0x2fdf45(0x18b)}],'isError':!![]};default:return null;}}args[a0_0x525535(0x1b2)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr('Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]'),logMcpStderr(a0_0x525535(0x1ff)),logMcpStderr(a0_0x525535(0x15e)),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x525535(0x247)),logMcpStderr('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x4becee){const _0x43b16c=a0_0x525535;return a0_0x368898[_0x43b16c(0x16f)](_0x4becee);}function expandHome(_0x20acc7){const _0x190c16=a0_0x525535;if(_0x20acc7[_0x190c16(0x1c9)]('~/')||_0x20acc7==='~')return a0_0x368898[_0x190c16(0x25b)](a0_0x55064c['homedir'](),_0x20acc7[_0x190c16(0x1bf)](0x1));return _0x20acc7;}let allowedDirectories=await Promise[a0_0x525535(0x231)](args['map'](async _0x232691=>{const _0x44c3a6=a0_0x525535,_0x303ab1=expandHome(_0x232691),_0xc4839=a0_0x368898[_0x44c3a6(0x162)](_0x303ab1);try{const _0x480f82=await a0_0x4128a0['realpath'](_0xc4839);return normalizePath(_0x480f82);}catch(_0x4b206c){return normalizePath(_0xc4839);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x525535(0x1b2)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x525535(0x1f8)](workspaceDir),logMcpStderr(a0_0x525535(0x250)+workspaceDir+a0_0x525535(0x177)));}catch(a0_0x29d551){logMcpStderr(a0_0x525535(0x1a0)+a0_0x29d551);}async function detectWorkspaceRoot(_0x3653e7){const _0x57a79a=a0_0x525535;let _0x1c2d2d=a0_0x368898['resolve'](_0x3653e7);const _0x2767a1=[_0x57a79a(0x1ef),_0x57a79a(0x21a),_0x57a79a(0x205),_0x57a79a(0x23e),_0x57a79a(0x1db),_0x57a79a(0x1dd),_0x57a79a(0x1b9),'tsconfig.json',_0x57a79a(0x251)];while(_0x1c2d2d!==a0_0x368898['dirname'](_0x1c2d2d)){for(const _0x5ce410 of _0x2767a1){const _0x308231=a0_0x368898['join'](_0x1c2d2d,_0x5ce410);try{return await a0_0x4128a0['access'](_0x308231),normalizePath(_0x1c2d2d);}catch{}}_0x1c2d2d=a0_0x368898[_0x57a79a(0x269)](_0x1c2d2d);}return normalizePath(_0x3653e7);}await Promise[a0_0x525535(0x231)](args[a0_0x525535(0x1bb)](async _0x4e200e=>{const _0x519e98=a0_0x525535;try{const _0x18e91d=await a0_0x4128a0['stat'](expandHome(_0x4e200e));!_0x18e91d[_0x519e98(0x229)]()&&(logMcpStderr(_0x519e98(0x1a8)+_0x4e200e+_0x519e98(0x270)),process[_0x519e98(0x1d8)](0x1));}catch(_0xb341e8){logMcpStderr(_0x519e98(0x20e)+_0x4e200e+':',_0xb341e8),process[_0x519e98(0x1d8)](0x1);}}));async function validatePath(_0x151ca4){const _0xc59c0b=a0_0x525535,_0x199e95=expandHome(_0x151ca4),_0x9eff54=a0_0x368898[_0xc59c0b(0x162)](_0x199e95);logger[_0xc59c0b(0x201)](_0xc59c0b(0x1b4),_0xc59c0b(0x214),{'raw_path':_0x151ca4,'absolute':_0x9eff54});try{const _0xbaae6f=await a0_0x4128a0[_0xc59c0b(0x213)](_0x9eff54);return logger['debug'](_0xc59c0b(0x1b4),_0xc59c0b(0x1a2),{'resolved':_0xbaae6f,'symlink':_0xbaae6f!==_0x9eff54}),_0xbaae6f;}catch(_0x3c2a44){if(_0x3c2a44['code']===_0xc59c0b(0x260)){const _0x26ede2=a0_0x368898['dirname'](_0x9eff54);try{const _0x482dbc=await a0_0x4128a0['realpath'](_0x26ede2),_0x2b604d=a0_0x368898['join'](_0x482dbc,a0_0x368898['basename'](_0x9eff54));return logger[_0xc59c0b(0x201)](_0xc59c0b(0x1b4),'path_validation_resolved',{'resolved':_0x2b604d,'new_file':!![]}),_0x2b604d;}catch{logger[_0xc59c0b(0x225)](_0xc59c0b(0x1b4),_0xc59c0b(0x204),{'raw_path':_0x151ca4,'error':'Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x26ede2});throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x26ede2);}}logger[_0xc59c0b(0x225)](_0xc59c0b(0x1b4),_0xc59c0b(0x204),{'raw_path':_0x151ca4,'error':_0x3c2a44[_0xc59c0b(0x22a)]});throw _0x3c2a44;}}const MorphEditFileArgsSchema=z[a0_0x525535(0x22c)]({'path':z['string'](),'code_edit':z[a0_0x525535(0x1a1)]()[a0_0x525535(0x1ac)](a0_0x525535(0x22e)),'instruction':z[a0_0x525535(0x1a1)]()['describe'](a0_0x525535(0x220)),'dryRun':z[a0_0x525535(0x26b)]()[a0_0x525535(0x172)](![])[a0_0x525535(0x1ac)](a0_0x525535(0x1f7))}),CODEBASE_SEARCH_QUERY_DESCRIPTION='Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.',WarpGrepArgsSchema=z[a0_0x525535(0x22c)]({'search_string':z[a0_0x525535(0x1a1)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x525535(0x1a1)]()['describe'](a0_0x525535(0x18d)),'search_type':z[a0_0x525535(0x1f2)]([a0_0x525535(0x172),a0_0x525535(0x24a)])[a0_0x525535(0x208)]()['describe'](a0_0x525535(0x1ba))}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z[a0_0x525535(0x1a1)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x525535(0x1a1)]()[a0_0x525535(0x208)]()['describe'](a0_0x525535(0x173)),'owner_repo':z[a0_0x525535(0x1a1)]()[a0_0x525535(0x208)]()[a0_0x525535(0x1ac)]('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z[a0_0x525535(0x1a1)]()[a0_0x525535(0x208)]()[a0_0x525535(0x1ac)](a0_0x525535(0x254))}),CodebaseSearchArgsSchema=z[a0_0x525535(0x22c)]({'query':z['string']()[a0_0x525535(0x1ac)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()['describe']('Repository\x20identifier'),'branch':z[a0_0x525535(0x1a1)]()[a0_0x525535(0x208)]()[a0_0x525535(0x1ac)](a0_0x525535(0x170)),'commitHash':z[a0_0x525535(0x1a1)]()[a0_0x525535(0x208)]()[a0_0x525535(0x1ac)](a0_0x525535(0x1d4)),'targetDirectories':z[a0_0x525535(0x184)](z['string']())[a0_0x525535(0x172)]([])[a0_0x525535(0x1ac)](a0_0x525535(0x238)),'limit':z[a0_0x525535(0x1f3)]()[a0_0x525535(0x208)]()[a0_0x525535(0x172)](0xa)[a0_0x525535(0x1ac)]('Max\x20results\x20to\x20return')}),server=new Server({'name':a0_0x525535(0x1fe),'version':a0_0x525535(0x1be)},{'capabilities':{'tools':{}}});server[a0_0x525535(0x1f9)](ListToolsRequestSchema,async()=>{const _0x4ae465=a0_0x525535,_0x5374e5=[{'name':TOOL_NAMES[_0x4ae465(0x249)],'description':_0x4ae465(0x1a7)+_0x4ae465(0x258)+'-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a'+_0x4ae465(0x190)+'-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a'+'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'+'Example\x20format:\x0a'+'//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a'+'Rules:\x0a'+_0x4ae465(0x16c)+_0x4ae465(0x1b3)+_0x4ae465(0x234)+_0x4ae465(0x25e),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES['CODEBASE_SEARCH'],'description':'A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20'+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x4ae465(0x165)+_0x4ae465(0x1e4)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x35b960=_0x5374e5[_0x4ae465(0x1c7)](_0x3cafad=>{const _0x285bf1=_0x4ae465;if(DISABLED_TOOLS['has'](_0x3cafad['name']))return console[_0x285bf1(0x225)](_0x285bf1(0x18e)+_0x3cafad[_0x285bf1(0x222)]+_0x285bf1(0x246)),![];if('requiresApiKey'in _0x3cafad&&_0x3cafad['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0x285bf1(0x1aa)+_0x3cafad[_0x285bf1(0x222)]+_0x285bf1(0x1e0)),![];return!![];});return{'tools':_0x35b960[_0x4ae465(0x1bb)](_0xa9cb7b=>({'name':_0xa9cb7b['name'],'description':_0xa9cb7b[_0x4ae465(0x154)],'inputSchema':_0xa9cb7b['inputSchema']}))};}),server[a0_0x525535(0x1f9)](CallToolRequestSchema,async _0x2e96b0=>{const _0x170471=a0_0x525535,{name:_0x2a3159,arguments:_0x592b7e}=_0x2e96b0[_0x170471(0x26c)],_0x9fc9d0=Date[_0x170471(0x17c)]();logger[_0x170471(0x201)](_0x170471(0x1b4),'tool_call_received',{'tool':_0x2a3159,'args':_0x2a3159==='edit_file'?{'path':_0x592b7e?.[_0x170471(0x168)],'instruction':_0x592b7e?.[_0x170471(0x1fc)]||_0x592b7e?.[_0x170471(0x1ce)],'dryRun':_0x592b7e?.[_0x170471(0x1bc)]}:_0x592b7e});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x170471(0x1da),'text':_0x170471(0x1c6)}],'isError':!![]};if(!MORPH_API_KEY[_0x170471(0x1c9)](_0x170471(0x200))&&!MORPH_API_KEY['startsWith'](_0x170471(0x21c)))return{'content':[{'type':_0x170471(0x1da),'text':_0x170471(0x230)}],'isError':!![]};if(DISABLED_TOOLS[_0x170471(0x187)](_0x2a3159))return{'content':[{'type':_0x170471(0x1da),'text':_0x170471(0x198)+_0x2a3159+_0x170471(0x23a)}],'isError':![]};switch(_0x2a3159){case TOOL_NAMES['EDIT_FILE']:{let _0x41f18c=_0x592b7e;if(_0x41f18c&&typeof _0x41f18c===_0x170471(0x22c)){if(!(_0x170471(0x168)in _0x41f18c)){const _0x20e92a=_0x41f18c['target_file']??_0x41f18c[_0x170471(0x23f)]??_0x41f18c[_0x170471(0x224)]??_0x41f18c[_0x170471(0x24f)]??_0x41f18c[_0x170471(0x176)];if(_0x20e92a)_0x41f18c={..._0x41f18c,'path':_0x20e92a};}_0x170471(0x1ce)in _0x41f18c&&!(_0x170471(0x1fc)in _0x41f18c)&&(_0x41f18c={..._0x41f18c,'instruction':_0x41f18c['instructions']});if(!(_0x170471(0x203)in _0x41f18c)){const _0x23aae2=_0x41f18c[_0x170471(0x1c1)]??_0x41f18c[_0x170471(0x221)]??_0x41f18c[_0x170471(0x21e)]??_0x41f18c[_0x170471(0x24d)];if(_0x23aae2)_0x41f18c={..._0x41f18c,'code_edit':_0x23aae2};}}const _0x30d794=MorphEditFileArgsSchema[_0x170471(0x1e8)](_0x41f18c);if(!_0x30d794[_0x170471(0x1b6)])throw new Error(_0x170471(0x263)+_0x30d794[_0x170471(0x225)]);const _0x224a38=await validatePath(_0x30d794[_0x170471(0x272)][_0x170471(0x168)]);let _0x24ab25=null,_0x182e08=!![],_0x153626=null;try{_0x24ab25=await a0_0x4128a0[_0x170471(0x240)](_0x224a38,_0x170471(0x15d)),logger[_0x170471(0x201)](_0x170471(0x1b4),_0x170471(0x1b1),{'path':_0x224a38,'size_bytes':_0x24ab25[_0x170471(0x1b2)]});}catch(_0x271951){const _0x452092=_0x271951['code'];_0x452092==='ENOENT'?(_0x182e08=![],_0x24ab25='',logger['debug']('MCP',_0x170471(0x1b1),{'path':_0x224a38,'exists':![]})):(_0x153626='Failed\x20to\x20read\x20file:\x20'+(_0x452092||_0x170471(0x199))+_0x170471(0x26a)+(_0x271951 instanceof Error?_0x271951[_0x170471(0x22a)]:String(_0x271951)),logger[_0x170471(0x225)]('MCP','file_read_failed',{'path':_0x224a38,'error':_0x153626}),logMcpStderr(_0x170471(0x1aa)+_0x153626));}let _0x23793d;try{const _0x7e2abb=MORPH_API_KEY;if(!_0x7e2abb)throw new Error(_0x170471(0x192));const _0x590bec=a0_0x368898[_0x170471(0x269)](_0x224a38),_0xd92589=a0_0x368898['basename'](_0x224a38);logger[_0x170471(0x201)](_0x170471(0x1b4),_0x170471(0x179),{'model':_0x170471(0x1e9),'path':_0x30d794[_0x170471(0x272)]['path'],'instruction_len':_0x30d794[_0x170471(0x272)]['instruction'][_0x170471(0x1b2)],'code_edit_len':_0x30d794['data'][_0x170471(0x203)][_0x170471(0x1b2)],'original_code_len':_0x24ab25?.['length']??0x0,'dry_run':_0x30d794['data'][_0x170471(0x1bc)]});const _0x502b74=Date[_0x170471(0x17c)](),_0x417f7f=await executeEditFile({'target_filepath':_0xd92589,'code_edit':_0x30d794['data'][_0x170471(0x203)],'instruction':_0x30d794['data'][_0x170471(0x1fc)]},{'morphApiKey':_0x7e2abb,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x590bec,'autoWrite':!_0x30d794[_0x170471(0x272)][_0x170471(0x1bc)],'generateUdiff':![],'debug':![]}),_0x1df48b=Date[_0x170471(0x17c)]()-_0x502b74;_0x23793d=_0x417f7f[_0x170471(0x15a)];if(!_0x417f7f['success'])throw new Error(_0x417f7f[_0x170471(0x225)]||_0x170471(0x1ca));const _0x21de4e=_0x417f7f[_0x170471(0x19b)],_0x200408=_0x170471(0x268)+_0x21de4e['linesAdded']+_0x170471(0x1f4)+_0x21de4e['linesRemoved']+',\x20modified\x20'+_0x21de4e[_0x170471(0x206)];logger[_0x170471(0x201)](_0x170471(0x1b4),'tool_call_complete',{'tool':_0x170471(0x26e),'success':!![],'latency_ms':Date[_0x170471(0x17c)]()-_0x9fc9d0,'edit_latency_ms':_0x1df48b,'changes':{'added':_0x21de4e['linesAdded'],'removed':_0x21de4e[_0x170471(0x1d5)],'modified':_0x21de4e[_0x170471(0x206)]},'completion_id':_0x23793d});if(_0x30d794[_0x170471(0x272)][_0x170471(0x1bc)])return{'content':[{'type':'text','text':'Morph\x20Edit\x20Preview'+(_0x182e08?'':_0x170471(0x1d7))+':\x20'+_0x30d794[_0x170471(0x272)][_0x170471(0x1fc)]+_0x170471(0x210)+_0x200408+_0x170471(0x1a4)+_0x30d794['data'][_0x170471(0x168)]+'.'}]};return{'content':[{'type':_0x170471(0x1da),'text':_0x170471(0x19e)+(_0x182e08?_0x170471(0x161):_0x170471(0x233))+':\x20'+_0x30d794[_0x170471(0x272)][_0x170471(0x1fc)]+'.\x20Changes:\x20'+_0x200408+_0x170471(0x1a4)+_0x30d794[_0x170471(0x272)]['path']+'.'}]};}catch(_0x270cff){const _0x8d0af2=handleMorphAPIError(_0x270cff);if(_0x8d0af2)return logger[_0x170471(0x225)]('MCP',_0x170471(0x1a3),{'tool':_0x170471(0x26e),'error':_0x170471(0x163),'latency_ms':Date['now']()-_0x9fc9d0}),_0x8d0af2;const _0x541309=_0x270cff instanceof Error?_0x270cff[_0x170471(0x22a)]:String(_0x270cff);return logger[_0x170471(0x225)](_0x170471(0x1b4),'tool_call_error',{'tool':_0x170471(0x26e),'error':_0x541309,'path':_0x30d794['data'][_0x170471(0x168)],'validated_path':_0x224a38,'latency_ms':Date[_0x170471(0x17c)]()-_0x9fc9d0,'stack':_0x270cff instanceof Error?_0x270cff[_0x170471(0x264)]:undefined}),reportMorphError({'error_message':_0x541309,'error_type':_0x270cff instanceof Error?_0x270cff[_0x170471(0x243)][_0x170471(0x222)]:_0x170471(0x1a6),'context':{'tool':_0x170471(0x26e),'completion_id':_0x23793d,'file_path':_0x30d794[_0x170471(0x272)][_0x170471(0x168)],'validated_path':_0x224a38,'instruction':_0x30d794[_0x170471(0x272)][_0x170471(0x1fc)],'model':MORPH_LARGE_APPLY?_0x170471(0x19d):'morph-v3-fast','dry_run':_0x30d794[_0x170471(0x272)]['dryRun'],'file_exists':_0x182e08,'file_read_error':_0x153626,'file_readable':_0x24ab25!==null,'request_content':{'path':_0x30d794[_0x170471(0x272)]['path'],'code_edit':_0x30d794['data'][_0x170471(0x203)],'instruction':_0x30d794[_0x170471(0x272)]['instruction'],'original_code':_0x24ab25!==null?_0x24ab25[_0x170471(0x1b2)]>0xc350?_0x24ab25[_0x170471(0x24b)](0x0,0xc350)+_0x170471(0x1a5)+_0x24ab25['length']+_0x170471(0x167):_0x24ab25:_0x170471(0x16e)+(_0x153626||_0x170471(0x175))+']','original_code_length':_0x24ab25?.[_0x170471(0x1b2)]??0x0,'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x170471(0x1e9),'dry_run':_0x30d794[_0x170471(0x272)][_0x170471(0x1bc)]}},'stack_trace':_0x270cff instanceof Error?_0x270cff[_0x170471(0x264)]:undefined,'source':_0x170471(0x178)})[_0x170471(0x261)](()=>{}),{'content':[{'type':_0x170471(0x1da),'text':_0x170471(0x16b)+_0x541309}],'isError':!![]};}}case TOOL_NAMES[_0x170471(0x259)]:{const _0x46d926=WarpGrepArgsSchema[_0x170471(0x1e8)](_0x592b7e);if(!_0x46d926[_0x170471(0x1b6)])return{'content':[{'type':_0x170471(0x1da),'text':'Invalid\x20arguments:\x20'+_0x46d926['error']}],'isError':!![]};const _0x31547b=_0x40e023=>{const _0x4323f9=_0x170471,_0x2c2393=[];for(const _0x3f921a of _0x40e023||[]){if(_0x3f921a[_0x4323f9(0x174)]==='assistant'&&Array[_0x4323f9(0x1d3)](_0x3f921a['tool_calls']))for(const _0x64045c of _0x3f921a[_0x4323f9(0x227)]){try{const _0x58a0d6=_0x64045c[_0x4323f9(0x1d1)]?.[_0x4323f9(0x222)],_0x5814d5=JSON[_0x4323f9(0x211)](_0x64045c[_0x4323f9(0x1d1)]?.['arguments']||'{}');if(_0x58a0d6===_0x4323f9(0x239))_0x2c2393['push'](_0x4323f9(0x245)+_0x5814d5[_0x4323f9(0x266)]+'\x27\x20'+(_0x5814d5[_0x4323f9(0x168)]||'.'));else{if(_0x58a0d6===_0x4323f9(0x1f0))_0x2c2393[_0x4323f9(0x1f8)](_0x4323f9(0x188)+_0x5814d5[_0x4323f9(0x168)]);else{if(_0x58a0d6==='list_directory')_0x2c2393['push'](_0x4323f9(0x1fa)+(_0x5814d5['command']||'.'));else{if(_0x58a0d6===_0x4323f9(0x185))_0x2c2393[_0x4323f9(0x1f8)](_0x4323f9(0x169)+_0x5814d5[_0x4323f9(0x266)]+'\x27\x20'+(_0x5814d5['path']||'.'));else _0x58a0d6===_0x4323f9(0x256)&&_0x2c2393[_0x4323f9(0x1f8)](_0x4323f9(0x256));}}}}catch{}}}return _0x2c2393;},_0x308a52=_0x316c84=>{const _0x5b04f2=_0x170471,_0x330a3c=[];if(!_0x316c84||!Array['isArray'](_0x316c84))return _0x330a3c;const _0x5416fe=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':'FileNotFound','tool':_0x5b04f2(0x1f0)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x5b04f2(0x1f0)},{'pattern':/\[READ ERROR\]/,'error_type':_0x5b04f2(0x1c5),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x5b04f2(0x1ab),'tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x5b04f2(0x22f),'tool':_0x5b04f2(0x1d9)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x5b04f2(0x1eb),'tool':_0x5b04f2(0x1d9)},{'pattern':/\[BINARY FILE\]/,'error_type':'BinaryFile','tool':_0x5b04f2(0x1f0)},{'pattern':/\[SYMLINK\]/,'error_type':_0x5b04f2(0x1b5),'tool':_0x5b04f2(0x1f0)},{'pattern':/not a text file/,'error_type':_0x5b04f2(0x1ab),'tool':'read'},{'pattern':/symbolic link/,'error_type':_0x5b04f2(0x1b5),'tool':_0x5b04f2(0x1f0)},{'pattern':/Error reading file:/,'error_type':_0x5b04f2(0x1c5),'tool':_0x5b04f2(0x1f0)},{'pattern':/status="error"/,'error_type':_0x5b04f2(0x182),'tool':_0x5b04f2(0x199)}];let _0xdc5fd3=0x0;for(const _0x50f484 of _0x316c84){_0x50f484[_0x5b04f2(0x174)]===_0x5b04f2(0x15b)&&Array['isArray'](_0x50f484[_0x5b04f2(0x227)])&&_0xdc5fd3++;const _0xb12f3e=_0x50f484[_0x5b04f2(0x21e)];if((_0x50f484[_0x5b04f2(0x174)]===_0x5b04f2(0x186)||_0x50f484[_0x5b04f2(0x174)]===_0x5b04f2(0x1b0))&&_0xb12f3e&&typeof _0xb12f3e===_0x5b04f2(0x1a1))for(const {pattern:_0x2ec384,error_type:_0x1c4ffc,tool:_0x27066a}of _0x5416fe){const _0x9ac5b4=_0xb12f3e[_0x5b04f2(0x1cb)](new RegExp(_0x2ec384[_0x5b04f2(0x248)],'g'));if(_0x9ac5b4)for(const _0x1c74a2 of _0x9ac5b4){const _0x3d4e9c=_0xb12f3e[_0x5b04f2(0x164)](_0x1c74a2),_0x1b3902=_0xb12f3e[_0x5b04f2(0x24b)](_0x3d4e9c,Math[_0x5b04f2(0x17a)](_0x3d4e9c+0xc8,_0xb12f3e[_0x5b04f2(0x1b2)]));_0x330a3c[_0x5b04f2(0x1f8)]({'tool':_0x27066a,'error_type':_0x1c4ffc,'error_message':_0x1b3902[_0x5b04f2(0x253)]('\x0a')[0x0],'turn':_0xdc5fd3});}}}return _0x330a3c;};try{const _0x2eecb8=a0_0x368898[_0x170471(0x162)](_0x46d926[_0x170471(0x272)][_0x170471(0x21f)]),_0x375040=_0x46d926[_0x170471(0x272)][_0x170471(0x1c4)],_0x6d7054=_0x375040===_0x170471(0x24a)?{'allowNames':[_0x170471(0x24a)]}:undefined,_0x2fa7b4=new LocalRipgrepProvider(_0x2eecb8,undefined,_0x6d7054);logger['debug']('MCP','provider_created',{'type':_0x170471(0x160),'repo_root':_0x2eecb8,'search_type':_0x375040||_0x170471(0x172)}),logger[_0x170471(0x201)](_0x170471(0x1b4),_0x170471(0x1fd),{'query':_0x46d926[_0x170471(0x272)][_0x170471(0x212)],'repo_root':_0x2eecb8,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x1da3f5=Date[_0x170471(0x17c)](),_0x31047f=await runWarpGrep({'searchTerm':_0x46d926[_0x170471(0x272)][_0x170471(0x212)],'repoRoot':_0x2eecb8,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x2fa7b4,'search_type':_0x375040}),_0x516e17=Date[_0x170471(0x17c)]()-_0x1da3f5,_0x375aa6=_0x31047f[_0x170471(0x256)]?.[_0x170471(0x1e7)]?.[_0x170471(0x273)]?.[_0x170471(0x1b2)]??0x0;logger['debug'](_0x170471(0x1b4),'warp_grep_complete',{'termination':_0x31047f[_0x170471(0x1d6)],'turns':_0x31047f[_0x170471(0x1b7)]?.[_0x170471(0x1f5)]??0x0,'files_found':_0x375aa6,'latency_ms':_0x516e17});const _0xe9b0e=_0x308a52(_0x31047f[_0x170471(0x155)]);_0xe9b0e[_0x170471(0x1b2)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0xe9b0e[_0x170471(0x1b2)]+_0x170471(0x276),'error_type':'SubToolError','level':_0x170471(0x262),'tool':_0x170471(0x217),'context':{'repo_path':_0x46d926[_0x170471(0x272)][_0x170471(0x21f)],'query':_0x46d926[_0x170471(0x272)][_0x170471(0x212)],'model':_0x170471(0x193),'termination_reason':_0x31047f[_0x170471(0x1d6)],'sub_tool_errors':_0xe9b0e,'timings':_0x31047f[_0x170471(0x1b7)],'tool_calls':_0x31547b(_0x31047f['messages']),'messages':_0x31047f[_0x170471(0x155)]?.[_0x170471(0x1bb)](_0x4610c1=>({'role':_0x4610c1[_0x170471(0x174)],'content':_0x4610c1['content'],..._0x4610c1['tool_calls']?{'tool_calls':_0x4610c1[_0x170471(0x227)][_0x170471(0x1b2)]}:{},..._0x4610c1['tool_call_id']?{'tool_call_id':_0x4610c1['tool_call_id']}:{}}))},'source':_0x170471(0x178)})[_0x170471(0x261)](()=>{});let _0x383ee7='';if(_0x31047f['terminationReason']===_0x170471(0x17b)&&_0x31047f[_0x170471(0x256)]?.[_0x170471(0x1e7)]?.[_0x170471(0x273)]){const _0x17f043=_0x31047f['finish'][_0x170471(0x1e7)][_0x170471(0x273)];if(_0x17f043[_0x170471(0x1b2)]===0x0)return _0x383ee7=_0x31047f[_0x170471(0x256)][_0x170471(0x20c)]||_0x170471(0x1af),{'content':[{'type':_0x170471(0x1da),'text':_0x383ee7}]};const _0x567377=[],_0x200235=[_0x170471(0x14f)];for(const _0x508670 of _0x31047f[_0x170471(0x155)]){if(_0x508670[_0x170471(0x174)]===_0x170471(0x15b)&&Array[_0x170471(0x1d3)](_0x508670[_0x170471(0x227)]))for(const _0x1a4398 of _0x508670[_0x170471(0x227)]){try{const _0x385af2=_0x1a4398[_0x170471(0x1d1)]?.['name'],_0x1142c9=JSON[_0x170471(0x211)](_0x1a4398[_0x170471(0x1d1)]?.[_0x170471(0x228)]||'{}');if(_0x385af2===_0x170471(0x239))_0x200235[_0x170471(0x1f8)](_0x170471(0x22d)+_0x1142c9[_0x170471(0x266)]+_0x170471(0x20f)+(_0x1142c9[_0x170471(0x168)]||'.')+'`');else{if(_0x385af2===_0x170471(0x1f0))_0x200235[_0x170471(0x1f8)](_0x170471(0x180)+_0x1142c9[_0x170471(0x168)]+'`');else{if(_0x385af2==='list_directory')_0x200235['push'](_0x170471(0x15f)+(_0x1142c9[_0x170471(0x257)]||'.')+'`');else _0x385af2===_0x170471(0x185)&&_0x200235['push'](_0x170471(0x232)+_0x1142c9[_0x170471(0x266)]+_0x170471(0x16d)+(_0x1142c9['path']||'.')+'`');}}}catch{}}}_0x567377['push'](_0x200235[_0x170471(0x25b)]('\x0a'));const _0x226cb2=['',_0x170471(0x255)];for(const _0x577cf2 of _0x17f043){if(_0x577cf2[_0x170471(0x1df)]==='*')_0x226cb2[_0x170471(0x1f8)]('-\x20'+_0x577cf2[_0x170471(0x168)]+':*');else{if(Array[_0x170471(0x1d3)](_0x577cf2[_0x170471(0x1df)])){const _0x30dc6f=_0x577cf2['lines'][_0x170471(0x1bb)](([_0x576fd7,_0x34ccd0])=>{if(_0x576fd7===_0x34ccd0)return''+_0x576fd7;return _0x576fd7+'-'+_0x34ccd0;});_0x226cb2[_0x170471(0x1f8)]('-\x20'+_0x577cf2[_0x170471(0x168)]+':'+_0x30dc6f['join'](','));}else _0x226cb2[_0x170471(0x1f8)]('-\x20'+_0x577cf2[_0x170471(0x168)]+':*');}}_0x226cb2[_0x170471(0x1f8)](''),_0x567377[_0x170471(0x1f8)](_0x226cb2[_0x170471(0x25b)]('\x0a')),_0x567377[_0x170471(0x1f8)](_0x170471(0x17e));const _0x2e4ea5=[],_0x954db3=[];for(const _0x309c84 of _0x17f043){let _0x460bc7=a0_0x368898[_0x170471(0x162)](_0x46d926[_0x170471(0x272)][_0x170471(0x21f)],_0x309c84['path']),_0x470d9a=null,_0xb19f0f=null;try{_0x470d9a=await a0_0x4128a0[_0x170471(0x240)](_0x460bc7,{'encoding':'utf-8'});}catch(_0x473e08){const _0x34b469=fixPathRepetition(_0x460bc7);if(_0x34b469)try{_0x470d9a=await a0_0x4128a0[_0x170471(0x240)](_0x34b469,{'encoding':_0x170471(0x15d)}),_0x460bc7=_0x34b469;}catch{_0xb19f0f=_0x473e08 instanceof Error?_0x473e08:new Error(String(_0x473e08));}else _0xb19f0f=_0x473e08 instanceof Error?_0x473e08:new Error(String(_0x473e08));}if(_0x470d9a!==null){const _0x249117=_0x470d9a[_0x170471(0x253)](/\r?\n/),_0x481d22=[];if(_0x309c84['lines']==='*'||!Array[_0x170471(0x1d3)](_0x309c84[_0x170471(0x1df)]))for(let _0x150e27=0x1;_0x150e27<=_0x249117['length'];_0x150e27++){const _0x231405=_0x249117[_0x150e27-0x1];_0x481d22[_0x170471(0x1f8)](_0x150e27+'|\x20'+_0x231405);}else for(const [_0x1a8e4c,_0x422a94]of _0x309c84['lines']){_0x481d22[_0x170471(0x1b2)]>0x0&&_0x481d22[_0x170471(0x1f8)]('');for(let _0x2f40b9=_0x1a8e4c;_0x2f40b9<=_0x422a94&&_0x2f40b9<=_0x249117[_0x170471(0x1b2)];_0x2f40b9++){const _0x233d06=_0x249117[_0x2f40b9-0x1];_0x481d22[_0x170471(0x1f8)](_0x2f40b9+'|\x20'+_0x233d06);}}_0x954db3['push']({'path':_0x309c84[_0x170471(0x168)],'content':_0x481d22[_0x170471(0x25b)]('\x0a')});}else _0x2e4ea5['push']('<file\x20path=\x22'+_0x309c84[_0x170471(0x168)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0xb19f0f?.['message']||_0x170471(0x1fb))+_0x170471(0x216));}try{const _0x5f49a2=await compactFileContexts(_0x954db3,_0x46d926[_0x170471(0x272)][_0x170471(0x212)],MORPH_API_KEY,MORPH_API_URL);for(const _0x4a492e of _0x5f49a2){_0x2e4ea5['push'](_0x170471(0x17f)+_0x4a492e['path']+'\x22>\x0a'+_0x4a492e[_0x170471(0x21e)]+'\x0a</file>');}}catch(_0x1a0602){logger[_0x170471(0x262)](_0x170471(0x1b4),'compaction_failed',{'error':_0x1a0602 instanceof Error?_0x1a0602[_0x170471(0x22a)]:String(_0x1a0602),'files_count':_0x954db3['length']});for(const _0x42895b of _0x954db3){_0x2e4ea5[_0x170471(0x1f8)]('<file\x20path=\x22'+_0x42895b[_0x170471(0x168)]+_0x170471(0x156)+_0x42895b[_0x170471(0x21e)]+'\x0a</file>');}}_0x567377[_0x170471(0x1f8)](_0x2e4ea5[_0x170471(0x25b)]('\x0a\x0a')),_0x383ee7=_0x567377[_0x170471(0x25b)]('\x0a');const _0x5019b2=_0x31047f[_0x170471(0x252)]?.[_0x170471(0x1c7)](_0x5c66c5=>_0x5c66c5[_0x170471(0x22a)]?.[_0x170471(0x1c9)](_0x170471(0x235)))||[];if(_0x5019b2[_0x170471(0x1b2)]>0x0){const _0x1cdc0f=_0x5019b2[_0x170471(0x1bb)](_0x241717=>_0x241717['message'])['join'](';\x20');reportMorphError({'error_message':_0x1cdc0f,'error_type':'FileReadError','context':{'tool':_0x170471(0x217),'repo_path':_0x46d926[_0x170471(0x272)][_0x170471(0x21f)],'query':_0x46d926[_0x170471(0x272)][_0x170471(0x212)],'model':_0x170471(0x193),'termination_reason':'completed_with_file_errors','error_count':_0x5019b2[_0x170471(0x1b2)],'is_timeout':![],'timings':_0x31047f['timings'],'files_attempted':_0x17f043[_0x170471(0x1bb)](_0x292a8b=>({'path':_0x292a8b[_0x170471(0x168)],'lines':_0x292a8b[_0x170471(0x1df)]})),'tool_calls':_0x31547b(_0x31047f['messages']),'messages':_0x31047f[_0x170471(0x155)]?.[_0x170471(0x1bb)](_0x3fc007=>({'role':_0x3fc007[_0x170471(0x174)],'content':_0x3fc007[_0x170471(0x21e)],..._0x3fc007[_0x170471(0x227)]?{'tool_calls':_0x3fc007[_0x170471(0x227)][_0x170471(0x1b2)]}:{},..._0x3fc007['tool_call_id']?{'tool_call_id':_0x3fc007['tool_call_id']}:{}})),'request_content':{'query':_0x46d926['data'][_0x170471(0x212)],'repo_path':_0x46d926['data'][_0x170471(0x21f)],'repoRoot':a0_0x368898[_0x170471(0x162)](_0x46d926[_0x170471(0x272)][_0x170471(0x21f)]),'model':_0x170471(0x193)}},'source':_0x170471(0x178)})[_0x170471(0x261)](()=>{});}}else{if(_0x31047f['terminationReason']===_0x170471(0x207)&&_0x31047f['errors'][_0x170471(0x1b2)]>0x0){const _0x198c80=_0x31047f[_0x170471(0x252)][_0x170471(0x1bb)](_0x21dc19=>_0x21dc19[_0x170471(0x22a)])[_0x170471(0x25b)](';\x20');_0x383ee7=_0x170471(0x1a8)+_0x198c80;const _0x27da2a=_0x198c80['toLowerCase']()[_0x170471(0x1de)](_0x170471(0x191))||_0x198c80[_0x170471(0x25d)]()['includes'](_0x170471(0x25a))||_0x198c80[_0x170471(0x25d)]()[_0x170471(0x1de)](_0x170471(0x17d)),_0x447a9d=_0x31047f['finish']?.[_0x170471(0x1e7)]?.[_0x170471(0x273)],_0x3adc85=_0x31047f[_0x170471(0x252)][0x0];reportMorphError({'error_message':_0x198c80,'error_type':_0x27da2a?'TimeoutError':_0x3adc85?.[_0x170471(0x243)]?.[_0x170471(0x222)]||_0x170471(0x20a),'context':{'tool':'codebase_search','repo_path':_0x46d926['data'][_0x170471(0x21f)],'query':_0x46d926[_0x170471(0x272)]['search_string'],'model':_0x170471(0x193),'termination_reason':_0x31047f[_0x170471(0x1d6)],'error_count':_0x31047f['errors'][_0x170471(0x1b2)],'is_timeout':_0x27da2a,'timings':_0x31047f['timings'],'files_attempted':_0x447a9d?.['map'](_0x57c868=>({'path':_0x57c868[_0x170471(0x168)],'lines':_0x57c868[_0x170471(0x1df)]})),'tool_calls':_0x31547b(_0x31047f['messages']),'messages':_0x31047f[_0x170471(0x155)]?.[_0x170471(0x1bb)](_0x487352=>({'role':_0x487352[_0x170471(0x174)],'content':_0x487352[_0x170471(0x21e)],..._0x487352[_0x170471(0x227)]?{'tool_calls':_0x487352['tool_calls'][_0x170471(0x1b2)]}:{},..._0x487352[_0x170471(0x1e3)]?{'tool_call_id':_0x487352['tool_call_id']}:{}})),'request_content':{'query':_0x46d926[_0x170471(0x272)]['search_string'],'repo_path':_0x46d926['data'][_0x170471(0x21f)],'repoRoot':a0_0x368898[_0x170471(0x162)](_0x46d926[_0x170471(0x272)][_0x170471(0x21f)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x3adc85?.[_0x170471(0x264)]||undefined,'source':_0x170471(0x178)})[_0x170471(0x261)](()=>{});}else _0x383ee7=_0x170471(0x265);}return{'content':[{'type':_0x170471(0x1da),'text':_0x383ee7}]};}catch(_0x46f62f){const _0x402524=handleMorphAPIError(_0x46f62f);if(_0x402524)return logger[_0x170471(0x225)](_0x170471(0x1b4),_0x170471(0x1a3),{'tool':_0x170471(0x217),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x170471(0x17c)]()-_0x9fc9d0}),_0x402524;const _0x2328f2=_0x46f62f instanceof Error?_0x46f62f[_0x170471(0x22a)]:String(_0x46f62f);logger[_0x170471(0x225)](_0x170471(0x1b4),_0x170471(0x1a3),{'tool':'codebase_search','error':_0x2328f2,'repo_path':_0x46d926[_0x170471(0x272)][_0x170471(0x21f)],'query':_0x46d926[_0x170471(0x272)][_0x170471(0x212)],'latency_ms':Date['now']()-_0x9fc9d0});const _0x4e03b8=_0x2328f2[_0x170471(0x25d)]()['includes']('timeout')||_0x2328f2['toLowerCase']()['includes'](_0x170471(0x25a))||_0x2328f2['toLowerCase']()[_0x170471(0x1de)]('etimedout')||_0x46f62f instanceof Error&&_0x46f62f[_0x170471(0x222)]===_0x170471(0x19a);return reportMorphError({'error_message':_0x2328f2,'error_type':_0x4e03b8?'TimeoutError':_0x46f62f instanceof Error?_0x46f62f[_0x170471(0x243)]['name']:_0x170471(0x1a6),'context':{'tool':_0x170471(0x217),'repo_path':_0x46d926[_0x170471(0x272)][_0x170471(0x21f)],'query':_0x46d926['data'][_0x170471(0x212)],'model':_0x170471(0x193),'is_timeout':_0x4e03b8,'exception_phase':_0x170471(0x218),'request_content':{'query':_0x46d926[_0x170471(0x272)][_0x170471(0x212)],'repo_path':_0x46d926['data'][_0x170471(0x21f)],'repoRoot':a0_0x368898[_0x170471(0x162)](_0x46d926[_0x170471(0x272)][_0x170471(0x21f)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x46f62f instanceof Error?_0x46f62f['stack']:undefined,'source':_0x170471(0x178)})[_0x170471(0x261)](()=>{}),{'content':[{'type':_0x170471(0x1da),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x2328f2}],'isError':![]};}}case TOOL_NAMES['GITHUB_CODEBASE_SEARCH']:{const _0x1766ad=WarpGrepGitHubArgsSchema['safeParse'](_0x592b7e);if(!_0x1766ad[_0x170471(0x1b6)])return{'content':[{'type':_0x170471(0x1da),'text':_0x170471(0x1cf)+_0x1766ad[_0x170471(0x225)]}],'isError':!![]};const _0x1bdf0f=_0x1766ad[_0x170471(0x272)][_0x170471(0x202)]||_0x1766ad[_0x170471(0x272)][_0x170471(0x241)];if(!_0x1bdf0f)return{'content':[{'type':'text','text':'Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id'}],'isError':!![]};const _0x225bd3=MORPH_API_KEY;if(!_0x225bd3)throw new Error(_0x170471(0x192));const _0x159b09=Date[_0x170471(0x17c)]();logger[_0x170471(0x201)]('MCP','github_search_start',{'identifier':_0x1bdf0f,'query':_0x1766ad[_0x170471(0x272)][_0x170471(0x212)],'branch':_0x1766ad[_0x170471(0x272)]['branch']});try{const _0x25be65=new WarpGrepClient({'morphApiKey':_0x225bd3,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x43dd84=await _0x25be65[_0x170471(0x1d0)]({'searchTerm':_0x1766ad[_0x170471(0x272)][_0x170471(0x212)],'github':_0x1bdf0f,'branch':_0x1766ad[_0x170471(0x272)][_0x170471(0x159)]}),_0x11876b=Date['now']()-_0x159b09;logMcpStderr(_0x170471(0x1e1)+_0x11876b+_0x170471(0x24e)+_0x43dd84['success']);const _0xd083e3=formatResult(_0x43dd84);return{'content':[{'type':_0x170471(0x1da),'text':_0xd083e3}]};}catch(_0x4cc456){const _0x3f4000=handleMorphAPIError(_0x4cc456);if(_0x3f4000)return _0x3f4000;const _0x5394df=Date[_0x170471(0x17c)]()-_0x159b09,_0x1dcb73=_0x4cc456 instanceof Error?_0x4cc456[_0x170471(0x22a)]:String(_0x4cc456);return logMcpStderr('[github_codebase_search]\x20Failed\x20in\x20'+_0x5394df+_0x170471(0x209),_0x1dcb73),reportMorphError({'error_message':_0x1dcb73,'error_type':_0x4cc456 instanceof Error?_0x4cc456[_0x170471(0x243)][_0x170471(0x222)]:_0x170471(0x1a6),'context':{'tool':_0x170471(0x153),'github_url':_0x1bdf0f,'search_string':_0x1766ad['data']['search_string'],'branch':_0x1766ad[_0x170471(0x272)][_0x170471(0x159)]},'stack_trace':_0x4cc456 instanceof Error?_0x4cc456[_0x170471(0x264)]:undefined,'source':_0x170471(0x178),'tool':_0x170471(0x153),'latency_ms':_0x5394df})[_0x170471(0x261)](()=>{}),{'content':[{'type':_0x170471(0x1da),'text':_0x170471(0x242)+_0x1dcb73}],'isError':![]};}}default:throw new Error(_0x170471(0x194)+_0x2a3159);}}catch(_0x3513e9){const _0x2829ae=_0x3513e9 instanceof Error?_0x3513e9[_0x170471(0x22a)]:String(_0x3513e9);return reportMorphError({'error_message':_0x2829ae,'error_type':_0x3513e9 instanceof Error?_0x3513e9[_0x170471(0x243)]['name']:_0x170471(0x1a6),'context':{'tool':_0x2a3159,'arguments':_0x592b7e?JSON[_0x170471(0x196)](_0x592b7e)['substring'](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x3513e9 instanceof Error?_0x3513e9[_0x170471(0x264)]:undefined,'source':_0x170471(0x178)})[_0x170471(0x261)](()=>{}),{'content':[{'type':_0x170471(0x1da),'text':_0x170471(0x1a8)+_0x2829ae}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x17e096){const _0x4d9650=a0_0x525535,_0x2fd797=await getValidRootDirectories(_0x17e096);if(_0x2fd797['length']>0x0)allowedDirectories=[..._0x2fd797],logMcpStderr(_0x4d9650(0x1e6)+_0x2fd797['length']+_0x4d9650(0x1c0));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x2952b0=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x2952b0&&(allowedDirectories=[_0x2952b0],logMcpStderr(_0x4d9650(0x226)+_0x2952b0));}catch(_0x3fa6f8){logMcpStderr(_0x4d9650(0x1f6)+_0x3fa6f8);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0xe9775d=a0_0x525535;try{const _0xe03072=await server[_0xe9775d(0x1ea)]();_0xe03072&&'roots'in _0xe03072&&await updateAllowedDirectoriesFromRoots(_0xe03072[_0xe9775d(0x219)]);}catch(_0x490afe){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x490afe instanceof Error?_0x490afe[_0xe9775d(0x22a)]:String(_0x490afe));}}),server[a0_0x525535(0x20d)]=async()=>{const _0x4488de=a0_0x525535,_0x139f42=server[_0x4488de(0x267)]();if(_0x139f42?.[_0x4488de(0x219)])try{const _0x182172=await server['listRoots']();_0x182172&&_0x4488de(0x219)in _0x182172?await updateAllowedDirectoriesFromRoots(_0x182172[_0x4488de(0x219)]):logMcpStderr(_0x4488de(0x23b));}catch(_0x6f29d5){logMcpStderr(_0x4488de(0x223),_0x6f29d5 instanceof Error?_0x6f29d5[_0x4488de(0x22a)]:String(_0x6f29d5));}else{if(allowedDirectories['length']>0x0)logMcpStderr(_0x4488de(0x183),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x4488de(0x171));else throw new Error(_0x4488de(0x166));}}};async function runServer(){const _0x109d00=a0_0x525535,_0x54d1fb=new StdioServerTransport();await server['connect'](_0x54d1fb),logMcpStderr(_0x109d00(0x19f)),allowedDirectories['length']===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x525535(0x261)](_0xd49bec=>{const _0x380009=a0_0x525535;logMcpStderr(_0x380009(0x195),_0xd49bec),process[_0x380009(0x1d8)](0x1);});
|
|
2
|
+
const a0_0x5035ba=a0_0x2f96;(function(_0x4fa6c3,_0x439111){const _0x25d18c=a0_0x2f96,_0x176c80=_0x4fa6c3();while(!![]){try{const _0x83dd9f=-parseInt(_0x25d18c(0x28e))/0x1+-parseInt(_0x25d18c(0x306))/0x2*(-parseInt(_0x25d18c(0x2d4))/0x3)+-parseInt(_0x25d18c(0x1f4))/0x4+parseInt(_0x25d18c(0x238))/0x5+-parseInt(_0x25d18c(0x1f8))/0x6*(-parseInt(_0x25d18c(0x272))/0x7)+parseInt(_0x25d18c(0x2df))/0x8+-parseInt(_0x25d18c(0x283))/0x9;if(_0x83dd9f===_0x439111)break;else _0x176c80['push'](_0x176c80['shift']());}catch(_0x45e38c){_0x176c80['push'](_0x176c80['shift']());}}}(a0_0x18cf,0x188ae));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_0x1b5499 from'fs/promises';import a0_0x390fe1 from'path';import a0_0x5edaef from'os';import{createRequire}from'module';function a0_0x2f96(_0x14e543,_0x5905b5){_0x14e543=_0x14e543-0x1e0;const _0x18cf92=a0_0x18cf();let _0x2f965b=_0x18cf92[_0x14e543];return _0x2f965b;}function a0_0x18cf(){const _0x33d095=['-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','toISOString','1327968kzrelA','node_modules','tool_calls','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.','\x0a...\x20(truncated,\x20total:\x20','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','-\x20Read\x20file\x20`','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','text','[github_codebase_search]\x20Failed\x20in\x20','14410GwuPmY','finish','terminationReason','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','isDirectory','-\x20Grepped\x20\x27','connect','list_directory','file_path','trim','constructor','morph-v3-large','instruction','.\x20Path:\x20','FileReadError','added\x20','edit_file','RipgrepNotAvailable','Relevant\x20context\x20found:','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.','user','DISABLED_TOOLS','etimedout','metadata','string','target_file','\x20error(s)','GitHub\x20search\x20failed:\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','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','false','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','UnknownError','Bearer\x20','slice','data','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Parent\x20directory\x20does\x20not\x20exist:\x20','morph-warp-grep-v2.1','Preview\x20changes\x20without\x20applying\x20them.','source','tool_call_id','min','command','unknown','all','has','changes','tool_call_error','content','BinaryFile','ms.\x20Success:\x20','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','Tool\x20\x22','❌\x20Morph\x20Edit\x20Failed:\x20','github_search_start','--api-key=','Morph\x20Edit\x20','startsWith','searchGitHub','terminated','now','read','argv','Here\x20is\x20the\x20content\x20of\x20files:\x0a','join','composer.json','\x20disabled\x20via\x20DISABLED_TOOLS','env','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','6915ZeeLIv','timed\x20out','map','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Tool\x20','match','stringify','listRoots','api_request_start','normalize','@morphllm/morphmcp\x20','1382544NxUYvg','ToolException','0.2.0','length','linesModified','completionId','code_edit','roots','unknown\x20error','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','messages','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','pattern','status','search_string','owner_repo','every','object','\x22>\x0a','-\x20Preserve\x20exact\x20indentation\x0a','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','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.','success','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','ReadError','Unknown\x20error','stat','number','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','filePath','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.','Created\x20File','inputSchema','context','debug','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','<file\x20path=\x22','warp_grep_start','46TkYIjC','\x20(new\x20file)','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','Rules:\x0a','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','branch','repo_path','edit','PathError','path','CODEBASE_SEARCH','setRequestHandler','\x0aExamples:','push','TimeoutError','list_directory\x20','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','utf-8','timeout','runWarpGrep_call','dirname','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','catch','Invalid\x20arguments:\x20','Morph\x20Edit\x20Preview','some','--help','-\x20Listed\x20directory\x20`','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','read\x20','646472zDHFBt','payload','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','\x20valid\x20directories','4326ylLWKU','files','ENOENT','timings','completed_with_file_errors','Error\x20accessing\x20directory\x20','linesRemoved','realpath','instructions','basename','isArray','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','\x20is\x20not\x20a\x20directory','ENABLE_WORKSPACE_MODE','Failed\x20to\x20read\x20file:\x20','params','\x20as\x20allowed\x20directory','Fallback:\x20Using\x20workspace\x20root\x20','target_filepath','message','log','WarpGrepError','Max\x20results\x20to\x20return','Failed\x20to\x20request\x20roots\x20from\x20client:','file_read_complete','Error:\x20','GITHUB_CODEBASE_SEARCH','SubToolError','Warning:\x20Workspace\x20fallback\x20failed:\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','provider_created','tool','.git','Repository\x20identifier','WarpGrep\x20sub-tool\x20errors:\x20','Morph\x20FastApply\x20failed\x20without\x20error\x20message','name','oninitialized','tsconfig.json','Disabled\x20tools:\x20','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.',',\x20modified\x20','toLowerCase','ms:','assistant','completed','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','path_validation_resolved','--version','describe','size','Applied','function','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','lines','cwd','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','\x22.\x20Known\x20tools:\x20','turns','MCP','WORKSPACE_ROOT','response','linesAdded','MORPH_API_KEY','922870MthOJG','dryRun','Warning:\x20','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','glob\x20\x27','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','MORPH_WARP_GREP_TIMEOUT','array','version','\x22>\x0aError\x20reading\x20file:\x20','safeParse','homedir','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','[github_codebase_search]\x20Done\x20in\x20','stack','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','\x20\x20morph-mcp','sk-','../package.json','Workspace\x20mode\x20enabled:\x20Using\x20','resolve','\x0a</file>','arguments','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.','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','morph-v3-fast','indexOf','filter','glob','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','SymlinkError','tool_call_complete','optional','warn','path_validation_failed','errors','compaction_failed','default',',\x20removed\x20','.\x20Changes:\x20','role','exit','file','github_codebase_search','RipgrepError','mcp-filesystem','sep','boolean','error','morph-mcp','.cursor','api-key','codebase_search','morph-','split','grep','parse','133ZBtpgE','readFile','substring','\x0aOptions:','-\x20Glob\x20search\x20`','new_string','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','[could\x20not\x20read\x20file:\x20','includes','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','--api-key','code','FileNotFound','Parameters:\x0a'];a0_0x18cf=function(){return _0x33d095;};return a0_0x18cf();}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_0x8c58ac from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x5217e2){const _0x426551=a0_0x2f96,_0x37ad5b=_0x5217e2[_0x426551(0x26f)](a0_0x390fe1['sep'])[_0x426551(0x254)](Boolean);if(_0x37ad5b[_0x426551(0x2e2)]<0x2)return null;for(let _0x42ff5a=Math['floor'](_0x37ad5b[_0x426551(0x2e2)]/0x2);_0x42ff5a>=0x1;_0x42ff5a--){for(let _0x46e03a=0x0;_0x46e03a<=_0x37ad5b[_0x426551(0x2e2)]-0x2*_0x42ff5a;_0x46e03a++){const _0x45a1f4=_0x37ad5b['slice'](_0x46e03a,_0x46e03a+_0x42ff5a),_0x25b420=_0x37ad5b['slice'](_0x46e03a+_0x42ff5a,_0x46e03a+0x2*_0x42ff5a);if(_0x45a1f4[_0x426551(0x2ef)]((_0x25a5d5,_0x180414)=>_0x25a5d5===_0x25b420[_0x180414])){const _0x4810fe=[..._0x37ad5b[_0x426551(0x2b0)](0x0,_0x46e03a),..._0x37ad5b['slice'](_0x46e03a+_0x42ff5a)];return a0_0x390fe1[_0x426551(0x267)]+_0x4810fe[_0x426551(0x2cf)](a0_0x390fe1[_0x426551(0x267)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x12bc1f=a0_0x2f96;try{const _0x18b13b=require(_0x12bc1f(0x24a));return _0x18b13b[_0x12bc1f(0x240)]??_0x12bc1f(0x2ba);}catch(_0x1f43b7){return logMcpStderr(_0x12bc1f(0x1f2),_0x1f43b7),_0x12bc1f(0x2ba);}}function printHelp(){const _0x4c82eb=a0_0x2f96;console[_0x4c82eb(0x20c)](_0x4c82eb(0x2de)+getPackageVersion()),console[_0x4c82eb(0x20c)](_0x4c82eb(0x247)),console[_0x4c82eb(0x20c)](_0x4c82eb(0x275)),console[_0x4c82eb(0x20c)](_0x4c82eb(0x23b)),console[_0x4c82eb(0x20c)](_0x4c82eb(0x2c2)),console[_0x4c82eb(0x20c)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x4c82eb(0x20c)](_0x4c82eb(0x1e1)),console[_0x4c82eb(0x20c)](_0x4c82eb(0x248)),console[_0x4c82eb(0x20c)](_0x4c82eb(0x2b2));}const cliArgs=process[a0_0x5035ba(0x2cd)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x5035ba(0x228),'-v','-V']),HELP_FLAGS=new Set([a0_0x5035ba(0x1f0),'-h']);cliArgs[a0_0x5035ba(0x1ef)](_0x3d5907=>VERSION_FLAGS[a0_0x5035ba(0x2bc)](_0x3d5907))&&(console['log']('@morphllm/morphmcp\x20'+getPackageVersion()),process[a0_0x5035ba(0x262)](0x0));cliArgs[a0_0x5035ba(0x1ef)](_0x38cb17=>HELP_FLAGS['has'](_0x38cb17))&&(printHelp(),process[a0_0x5035ba(0x262)](0x0));function getCliArg(_0x4ef63f){const _0x5b20f0=a0_0x5035ba;for(let _0x3798cb=0x0;_0x3798cb<cliArgs[_0x5b20f0(0x2e2)];_0x3798cb++){const _0x4d45bd=cliArgs[_0x3798cb];if(_0x4d45bd[_0x5b20f0(0x2c8)]('--'+_0x4ef63f+'='))return _0x4d45bd[_0x5b20f0(0x2b0)](('--'+_0x4ef63f+'=')[_0x5b20f0(0x2e2)]);if(_0x4d45bd==='--'+_0x4ef63f&&_0x3798cb+0x1<cliArgs[_0x5b20f0(0x2e2)])return cliArgs[_0x3798cb+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x5035ba(0x2e2)];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS['has'](arg))continue;if(arg['startsWith'](a0_0x5035ba(0x2c6)))continue;if(arg===a0_0x5035ba(0x27d)){i++;continue;}args[a0_0x5035ba(0x1e2)](arg);}const WORKSPACE_ROOT=process['env'][a0_0x5035ba(0x234)]||process['env']['PWD']||process[a0_0x5035ba(0x22f)](),ENABLE_WORKSPACE_MODE=process[a0_0x5035ba(0x2d2)][a0_0x5035ba(0x205)]!==a0_0x5035ba(0x2ac),MORPH_API_KEY=getCliArg(a0_0x5035ba(0x26c))??process['env'][a0_0x5035ba(0x237)],MORPH_API_URL=process[a0_0x5035ba(0x2d2)]['MORPH_API_URL'],MORPH_LARGE_APPLY=process[a0_0x5035ba(0x2d2)]['MORPH_LARGE_APPLY']!==a0_0x5035ba(0x2ac),MORPH_WARP_GREP_TIMEOUT=process[a0_0x5035ba(0x2d2)][a0_0x5035ba(0x23e)]?parseInt(process[a0_0x5035ba(0x2d2)][a0_0x5035ba(0x23e)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x5035ba(0x2d2)][a0_0x5035ba(0x2a3)]?new Set(process[a0_0x5035ba(0x2d2)]['DISABLED_TOOLS'][a0_0x5035ba(0x26f)](',')['map'](_0x3eeba9=>_0x3eeba9[a0_0x5035ba(0x297)]())[a0_0x5035ba(0x254)](_0x12a26a=>_0x12a26a['length']>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x5035ba(0x22a)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x5035ba(0x269)](a0_0x5035ba(0x291)+tool+a0_0x5035ba(0x231)+[...KNOWN_TOOL_NAMES][a0_0x5035ba(0x2cf)](',\x20'));}console[a0_0x5035ba(0x269)](a0_0x5035ba(0x21f)+[...DISABLED_TOOLS][a0_0x5035ba(0x2cf)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x5035ba(0x2c8)](a0_0x5035ba(0x249))&&!MORPH_API_KEY['startsWith'](a0_0x5035ba(0x26e))&&logMcpStderr('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x438d36){const _0x2fa67e=a0_0x5035ba;try{await a0_0x8c58ac['post']('https://morphllm.com/api/error-report',{..._0x438d36,'timestamp':new Date()[_0x2fa67e(0x282)](),'source':_0x438d36[_0x2fa67e(0x2b6)]||_0x2fa67e(0x266),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x438d36[_0x2fa67e(0x301)]}},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x2fa67e(0x2af)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x49dfba,_0x326dc5){const _0x10eb47=a0_0x5035ba;if(_0x49dfba&&typeof _0x49dfba===_0x10eb47(0x2f0)&&_0x10eb47(0x2ec)in _0x49dfba)return _0x49dfba[_0x10eb47(0x2ec)];if(_0x49dfba&&typeof _0x49dfba===_0x10eb47(0x2f0)&&_0x10eb47(0x235)in _0x49dfba)return _0x49dfba[_0x10eb47(0x235)]?.['status'];const _0x9ef8af=_0x326dc5[_0x10eb47(0x2d9)](/\b(401|429)\b/);return _0x9ef8af?parseInt(_0x9ef8af[0x1],0xa):null;}function handleMorphAPIError(_0x34bdc7){const _0x5943d1=a0_0x5035ba,_0x4f5445=_0x34bdc7 instanceof Error?_0x34bdc7['message']:String(_0x34bdc7),_0x149f58=extractStatusCode(_0x34bdc7,_0x4f5445);switch(_0x149f58){case 0x191:return{'content':[{'type':_0x5943d1(0x28c),'text':_0x5943d1(0x2f4)}],'isError':!![]};case 0x1ad:return{'content':[{'type':'text','text':_0x5943d1(0x251)}],'isError':!![]};default:return null;}}args[a0_0x5035ba(0x2e2)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x5035ba(0x27c)),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr(a0_0x5035ba(0x2f3)),logMcpStderr(a0_0x5035ba(0x278)),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr(a0_0x5035ba(0x1f6)));function normalizePath(_0x41e013){const _0x22a6d6=a0_0x5035ba;return a0_0x390fe1[_0x22a6d6(0x2dd)](_0x41e013);}function expandHome(_0x2bf48a){const _0x212396=a0_0x5035ba;if(_0x2bf48a['startsWith']('~/')||_0x2bf48a==='~')return a0_0x390fe1['join'](a0_0x5edaef[_0x212396(0x243)](),_0x2bf48a[_0x212396(0x2b0)](0x1));return _0x2bf48a;}let allowedDirectories=await Promise[a0_0x5035ba(0x2bb)](args['map'](async _0x7ba6eb=>{const _0x575c3a=a0_0x5035ba,_0x6f2b98=expandHome(_0x7ba6eb),_0x2c4023=a0_0x390fe1[_0x575c3a(0x24c)](_0x6f2b98);try{const _0x2d2cf0=await a0_0x1b5499[_0x575c3a(0x1ff)](_0x2c4023);return normalizePath(_0x2d2cf0);}catch(_0x4d196e){return normalizePath(_0x2c4023);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x5035ba(0x1e2)](workspaceDir),logMcpStderr(a0_0x5035ba(0x24b)+workspaceDir+a0_0x5035ba(0x208)));}catch(a0_0x37f113){logMcpStderr(a0_0x5035ba(0x244)+a0_0x37f113);}async function detectWorkspaceRoot(_0x5cd8b7){const _0x481f7a=a0_0x5035ba;let _0x3cb63a=a0_0x390fe1['resolve'](_0x5cd8b7);const _0x23b94b=[_0x481f7a(0x218),'.vscode','package.json','Cargo.toml','pyproject.toml','go.mod',_0x481f7a(0x26b),_0x481f7a(0x21e),_0x481f7a(0x2d0)];while(_0x3cb63a!==a0_0x390fe1[_0x481f7a(0x1e9)](_0x3cb63a)){for(const _0x24b5f9 of _0x23b94b){const _0x1047b9=a0_0x390fe1['join'](_0x3cb63a,_0x24b5f9);try{return await a0_0x1b5499['access'](_0x1047b9),normalizePath(_0x3cb63a);}catch{}}_0x3cb63a=a0_0x390fe1['dirname'](_0x3cb63a);}return normalizePath(_0x5cd8b7);}await Promise[a0_0x5035ba(0x2bb)](args[a0_0x5035ba(0x2d6)](async _0x213d63=>{const _0x1298fe=a0_0x5035ba;try{const _0xa58da3=await a0_0x1b5499[_0x1298fe(0x2f9)](expandHome(_0x213d63));!_0xa58da3[_0x1298fe(0x292)]()&&(logMcpStderr(_0x1298fe(0x211)+_0x213d63+_0x1298fe(0x204)),process[_0x1298fe(0x262)](0x1));}catch(_0x1b77c0){logMcpStderr(_0x1298fe(0x1fd)+_0x213d63+':',_0x1b77c0),process[_0x1298fe(0x262)](0x1);}}));async function validatePath(_0x3e9bbf){const _0x3e65a0=a0_0x5035ba,_0x4a7bb8=expandHome(_0x3e9bbf),_0x5c2127=a0_0x390fe1[_0x3e65a0(0x24c)](_0x4a7bb8);logger[_0x3e65a0(0x302)]('MCP','path_validation_start',{'raw_path':_0x3e9bbf,'absolute':_0x5c2127});try{const _0x59cc36=await a0_0x1b5499[_0x3e65a0(0x1ff)](_0x5c2127);return logger['debug'](_0x3e65a0(0x233),_0x3e65a0(0x227),{'resolved':_0x59cc36,'symlink':_0x59cc36!==_0x5c2127}),_0x59cc36;}catch(_0x333027){if(_0x333027[_0x3e65a0(0x27e)]===_0x3e65a0(0x1fa)){const _0x27a157=a0_0x390fe1[_0x3e65a0(0x1e9)](_0x5c2127);try{const _0x4acb4a=await a0_0x1b5499[_0x3e65a0(0x1ff)](_0x27a157),_0x4057ec=a0_0x390fe1[_0x3e65a0(0x2cf)](_0x4acb4a,a0_0x390fe1[_0x3e65a0(0x201)](_0x5c2127));return logger[_0x3e65a0(0x302)](_0x3e65a0(0x233),_0x3e65a0(0x227),{'resolved':_0x4057ec,'new_file':!![]}),_0x4057ec;}catch{logger[_0x3e65a0(0x269)](_0x3e65a0(0x233),_0x3e65a0(0x25b),{'raw_path':_0x3e9bbf,'error':_0x3e65a0(0x2b3)+_0x27a157});throw new Error(_0x3e65a0(0x2b3)+_0x27a157);}}logger[_0x3e65a0(0x269)](_0x3e65a0(0x233),'path_validation_failed',{'raw_path':_0x3e9bbf,'error':_0x333027[_0x3e65a0(0x20b)]});throw _0x333027;}}const MorphEditFileArgsSchema=z[a0_0x5035ba(0x2f0)]({'path':z['string'](),'code_edit':z[a0_0x5035ba(0x2a6)]()['describe']('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z[a0_0x5035ba(0x2a6)]()[a0_0x5035ba(0x229)](a0_0x5035ba(0x1e5)),'dryRun':z[a0_0x5035ba(0x268)]()[a0_0x5035ba(0x25e)](![])[a0_0x5035ba(0x229)](a0_0x5035ba(0x2b5))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x5035ba(0x2a1),WarpGrepArgsSchema=z[a0_0x5035ba(0x2f0)]({'search_string':z['string']()[a0_0x5035ba(0x229)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()[a0_0x5035ba(0x229)](a0_0x5035ba(0x23d)),'search_type':z['enum'](['default',a0_0x5035ba(0x284)])['optional']()[a0_0x5035ba(0x229)](a0_0x5035ba(0x30b))}),WarpGrepGitHubArgsSchema=z[a0_0x5035ba(0x2f0)]({'search_string':z['string']()[a0_0x5035ba(0x229)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x5035ba(0x2a6)]()[a0_0x5035ba(0x259)]()[a0_0x5035ba(0x229)](a0_0x5035ba(0x286)),'owner_repo':z[a0_0x5035ba(0x2a6)]()['optional']()[a0_0x5035ba(0x229)](a0_0x5035ba(0x226)),'branch':z[a0_0x5035ba(0x2a6)]()[a0_0x5035ba(0x259)]()[a0_0x5035ba(0x229)](a0_0x5035ba(0x2fb))}),CodebaseSearchArgsSchema=z['object']({'query':z[a0_0x5035ba(0x2a6)]()[a0_0x5035ba(0x229)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x5035ba(0x2a6)]()[a0_0x5035ba(0x229)](a0_0x5035ba(0x219)),'branch':z[a0_0x5035ba(0x2a6)]()['optional']()['describe'](a0_0x5035ba(0x2fc)),'commitHash':z[a0_0x5035ba(0x2a6)]()[a0_0x5035ba(0x259)]()[a0_0x5035ba(0x229)]('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z[a0_0x5035ba(0x23f)](z[a0_0x5035ba(0x2a6)]())[a0_0x5035ba(0x25e)]([])[a0_0x5035ba(0x229)](a0_0x5035ba(0x1eb)),'limit':z[a0_0x5035ba(0x2fa)]()[a0_0x5035ba(0x259)]()[a0_0x5035ba(0x25e)](0xa)['describe'](a0_0x5035ba(0x20e))}),server=new Server({'name':a0_0x5035ba(0x26a),'version':a0_0x5035ba(0x2e1)},{'capabilities':{'tools':{}}});server[a0_0x5035ba(0x1e0)](ListToolsRequestSchema,async()=>{const _0x18857a=a0_0x5035ba,_0x4d8cb3=[{'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'+_0x18857a(0x280)+_0x18857a(0x309)+_0x18857a(0x1ea)+_0x18857a(0x256)+_0x18857a(0x2ab)+'Example\x20format:\x0a'+_0x18857a(0x28a)+_0x18857a(0x30a)+_0x18857a(0x281)+_0x18857a(0x2f2)+'-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a'+_0x18857a(0x28b),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x18857a(0x311)],'description':_0x18857a(0x203)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x18857a(0x288)+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x3fca80=_0x4d8cb3[_0x18857a(0x254)](_0x3fce00=>{const _0x32abc1=_0x18857a;if(DISABLED_TOOLS[_0x32abc1(0x2bc)](_0x3fce00[_0x32abc1(0x21c)]))return console['error'](_0x32abc1(0x2d8)+_0x3fce00[_0x32abc1(0x21c)]+_0x32abc1(0x2d1)),![];if('requiresApiKey'in _0x3fce00&&_0x3fce00['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x3fce00[_0x32abc1(0x21c)]+_0x32abc1(0x2d3)),![];return!![];});return{'tools':_0x3fca80[_0x18857a(0x2d6)](_0x487e9f=>({'name':_0x487e9f[_0x18857a(0x21c)],'description':_0x487e9f['description'],'inputSchema':_0x487e9f[_0x18857a(0x300)]}))};}),server[a0_0x5035ba(0x1e0)](CallToolRequestSchema,async _0x26e0b8=>{const _0x4492bc=a0_0x5035ba,{name:_0x33ec73,arguments:_0x189e0b}=_0x26e0b8[_0x4492bc(0x207)],_0x2c4ec8=Date[_0x4492bc(0x2cb)]();logger['debug'](_0x4492bc(0x233),'tool_call_received',{'tool':_0x33ec73,'args':_0x33ec73==='edit_file'?{'path':_0x189e0b?.[_0x4492bc(0x310)],'instruction':_0x189e0b?.[_0x4492bc(0x29a)]||_0x189e0b?.[_0x4492bc(0x200)],'dryRun':_0x189e0b?.[_0x4492bc(0x239)]}:_0x189e0b});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x4492bc(0x28c),'text':_0x4492bc(0x22d)}],'isError':!![]};if(!MORPH_API_KEY[_0x4492bc(0x2c8)]('sk-')&&!MORPH_API_KEY['startsWith'](_0x4492bc(0x26e)))return{'content':[{'type':'text','text':_0x4492bc(0x24f)}],'isError':!![]};if(DISABLED_TOOLS['has'](_0x33ec73))return{'content':[{'type':'text','text':_0x4492bc(0x2c3)+_0x33ec73+_0x4492bc(0x220)}],'isError':![]};switch(_0x33ec73){case TOOL_NAMES['EDIT_FILE']:{let _0x3e6219=_0x189e0b;if(_0x3e6219&&typeof _0x3e6219===_0x4492bc(0x2f0)){if(!(_0x4492bc(0x310)in _0x3e6219)){const _0x560cb7=_0x3e6219[_0x4492bc(0x2a7)]??_0x3e6219[_0x4492bc(0x2fd)]??_0x3e6219[_0x4492bc(0x20a)]??_0x3e6219[_0x4492bc(0x296)]??_0x3e6219[_0x4492bc(0x263)];if(_0x560cb7)_0x3e6219={..._0x3e6219,'path':_0x560cb7};}_0x4492bc(0x200)in _0x3e6219&&!(_0x4492bc(0x29a)in _0x3e6219)&&(_0x3e6219={..._0x3e6219,'instruction':_0x3e6219['instructions']});if(!(_0x4492bc(0x2e5)in _0x3e6219)){const _0x5ea36f=_0x3e6219[_0x4492bc(0x27e)]??_0x3e6219[_0x4492bc(0x277)]??_0x3e6219[_0x4492bc(0x2bf)]??_0x3e6219[_0x4492bc(0x30e)];if(_0x5ea36f)_0x3e6219={..._0x3e6219,'code_edit':_0x5ea36f};}}const _0x408980=MorphEditFileArgsSchema[_0x4492bc(0x242)](_0x3e6219);if(!_0x408980[_0x4492bc(0x2f5)])throw new Error(_0x4492bc(0x2e8)+_0x408980[_0x4492bc(0x269)]);const _0x3557eb=await validatePath(_0x408980[_0x4492bc(0x2b1)][_0x4492bc(0x310)]);let _0x1b45d8=null,_0x267ff8=!![],_0x17e731=null;try{_0x1b45d8=await a0_0x1b5499[_0x4492bc(0x273)](_0x3557eb,_0x4492bc(0x1e6)),logger[_0x4492bc(0x302)](_0x4492bc(0x233),_0x4492bc(0x210),{'path':_0x3557eb,'size_bytes':_0x1b45d8[_0x4492bc(0x2e2)]});}catch(_0x4ed777){const _0x30ec08=_0x4ed777[_0x4492bc(0x27e)];_0x30ec08===_0x4492bc(0x1fa)?(_0x267ff8=![],_0x1b45d8='',logger[_0x4492bc(0x302)](_0x4492bc(0x233),'file_read_complete',{'path':_0x3557eb,'exists':![]})):(_0x17e731=_0x4492bc(0x206)+(_0x30ec08||_0x4492bc(0x2ba))+'\x20-\x20'+(_0x4ed777 instanceof Error?_0x4ed777[_0x4492bc(0x20b)]:String(_0x4ed777)),logger[_0x4492bc(0x269)](_0x4492bc(0x233),'file_read_failed',{'path':_0x3557eb,'error':_0x17e731}),logMcpStderr(_0x4492bc(0x23a)+_0x17e731));}let _0x4d59c2;try{const _0x16aa45=MORPH_API_KEY;if(!_0x16aa45)throw new Error(_0x4492bc(0x2d7));const _0x15577c=a0_0x390fe1[_0x4492bc(0x1e9)](_0x3557eb),_0x17cf81=a0_0x390fe1[_0x4492bc(0x201)](_0x3557eb);logger[_0x4492bc(0x302)](_0x4492bc(0x233),_0x4492bc(0x2dc),{'model':_0x4492bc(0x252),'path':_0x408980[_0x4492bc(0x2b1)]['path'],'instruction_len':_0x408980[_0x4492bc(0x2b1)]['instruction']['length'],'code_edit_len':_0x408980['data'][_0x4492bc(0x2e5)][_0x4492bc(0x2e2)],'original_code_len':_0x1b45d8?.[_0x4492bc(0x2e2)]??0x0,'dry_run':_0x408980['data'][_0x4492bc(0x239)]});const _0xee0892=Date['now'](),_0x29433d=await executeEditFile({'target_filepath':_0x17cf81,'code_edit':_0x408980[_0x4492bc(0x2b1)]['code_edit'],'instruction':_0x408980['data'][_0x4492bc(0x29a)]},{'morphApiKey':_0x16aa45,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x15577c,'autoWrite':!_0x408980[_0x4492bc(0x2b1)][_0x4492bc(0x239)],'generateUdiff':![],'debug':![]}),_0x16e7f2=Date[_0x4492bc(0x2cb)]()-_0xee0892;_0x4d59c2=_0x29433d[_0x4492bc(0x2e4)];if(!_0x29433d[_0x4492bc(0x2f5)])throw new Error(_0x29433d[_0x4492bc(0x269)]||_0x4492bc(0x21b));const _0x16264d=_0x29433d[_0x4492bc(0x2bd)],_0x58a30a=_0x4492bc(0x29d)+_0x16264d[_0x4492bc(0x236)]+_0x4492bc(0x25f)+_0x16264d[_0x4492bc(0x1fe)]+_0x4492bc(0x221)+_0x16264d[_0x4492bc(0x2e3)];logger[_0x4492bc(0x302)](_0x4492bc(0x233),_0x4492bc(0x258),{'tool':_0x4492bc(0x29e),'success':!![],'latency_ms':Date[_0x4492bc(0x2cb)]()-_0x2c4ec8,'edit_latency_ms':_0x16e7f2,'changes':{'added':_0x16264d[_0x4492bc(0x236)],'removed':_0x16264d[_0x4492bc(0x1fe)],'modified':_0x16264d['linesModified']},'completion_id':_0x4d59c2});if(_0x408980[_0x4492bc(0x2b1)][_0x4492bc(0x239)])return{'content':[{'type':_0x4492bc(0x28c),'text':_0x4492bc(0x1ee)+(_0x267ff8?'':_0x4492bc(0x307))+':\x20'+_0x408980['data']['instruction']+_0x4492bc(0x260)+_0x58a30a+_0x4492bc(0x29b)+_0x408980[_0x4492bc(0x2b1)][_0x4492bc(0x310)]+'.'}]};return{'content':[{'type':_0x4492bc(0x28c),'text':_0x4492bc(0x2c7)+(_0x267ff8?_0x4492bc(0x22b):_0x4492bc(0x2ff))+':\x20'+_0x408980[_0x4492bc(0x2b1)]['instruction']+_0x4492bc(0x260)+_0x58a30a+_0x4492bc(0x29b)+_0x408980[_0x4492bc(0x2b1)]['path']+'.'}]};}catch(_0x32f252){const _0x4101aa=handleMorphAPIError(_0x32f252);if(_0x4101aa)return logger[_0x4492bc(0x269)](_0x4492bc(0x233),_0x4492bc(0x2be),{'tool':_0x4492bc(0x29e),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x4492bc(0x2cb)]()-_0x2c4ec8}),_0x4101aa;const _0x3a0782=_0x32f252 instanceof Error?_0x32f252[_0x4492bc(0x20b)]:String(_0x32f252);return logger[_0x4492bc(0x269)](_0x4492bc(0x233),_0x4492bc(0x2be),{'tool':_0x4492bc(0x29e),'error':_0x3a0782,'path':_0x408980[_0x4492bc(0x2b1)][_0x4492bc(0x310)],'validated_path':_0x3557eb,'latency_ms':Date[_0x4492bc(0x2cb)]()-_0x2c4ec8,'stack':_0x32f252 instanceof Error?_0x32f252[_0x4492bc(0x246)]:undefined}),reportMorphError({'error_message':_0x3a0782,'error_type':_0x32f252 instanceof Error?_0x32f252['constructor']['name']:'UnknownError','context':{'tool':_0x4492bc(0x29e),'completion_id':_0x4d59c2,'file_path':_0x408980[_0x4492bc(0x2b1)][_0x4492bc(0x310)],'validated_path':_0x3557eb,'instruction':_0x408980['data'][_0x4492bc(0x29a)],'model':MORPH_LARGE_APPLY?_0x4492bc(0x299):_0x4492bc(0x252),'dry_run':_0x408980[_0x4492bc(0x2b1)][_0x4492bc(0x239)],'file_exists':_0x267ff8,'file_read_error':_0x17e731,'file_readable':_0x1b45d8!==null,'request_content':{'path':_0x408980[_0x4492bc(0x2b1)]['path'],'code_edit':_0x408980[_0x4492bc(0x2b1)][_0x4492bc(0x2e5)],'instruction':_0x408980[_0x4492bc(0x2b1)][_0x4492bc(0x29a)],'original_code':_0x1b45d8!==null?_0x1b45d8[_0x4492bc(0x2e2)]>0xc350?_0x1b45d8['substring'](0x0,0xc350)+_0x4492bc(0x287)+_0x1b45d8[_0x4492bc(0x2e2)]+'\x20chars)':_0x1b45d8:_0x4492bc(0x27a)+(_0x17e731||_0x4492bc(0x2e7))+']','original_code_length':_0x1b45d8?.[_0x4492bc(0x2e2)]??0x0,'model':MORPH_LARGE_APPLY?_0x4492bc(0x299):_0x4492bc(0x252),'dry_run':_0x408980['data']['dryRun']}},'stack_trace':_0x32f252 instanceof Error?_0x32f252[_0x4492bc(0x246)]:undefined,'source':'mcp-filesystem'})[_0x4492bc(0x1ec)](()=>{}),{'content':[{'type':_0x4492bc(0x28c),'text':_0x4492bc(0x2c4)+_0x3a0782}],'isError':!![]};}}case TOOL_NAMES[_0x4492bc(0x311)]:{const _0x1e98d4=WarpGrepArgsSchema[_0x4492bc(0x242)](_0x189e0b);if(!_0x1e98d4[_0x4492bc(0x2f5)])return{'content':[{'type':_0x4492bc(0x28c),'text':'Invalid\x20arguments:\x20'+_0x1e98d4[_0x4492bc(0x269)]}],'isError':!![]};const _0x573713=_0x334d94=>{const _0x4bc638=_0x4492bc,_0x89faf7=[];for(const _0xefe52f of _0x334d94||[]){if(_0xefe52f[_0x4bc638(0x261)]==='assistant'&&Array['isArray'](_0xefe52f[_0x4bc638(0x285)]))for(const _0x423dba of _0xefe52f['tool_calls']){try{const _0x54f0cb=_0x423dba[_0x4bc638(0x22c)]?.['name'],_0x1fb22a=JSON[_0x4bc638(0x271)](_0x423dba[_0x4bc638(0x22c)]?.[_0x4bc638(0x24e)]||'{}');if(_0x54f0cb==='grep_search')_0x89faf7[_0x4bc638(0x1e2)]('grep\x20\x27'+_0x1fb22a[_0x4bc638(0x2eb)]+'\x27\x20'+(_0x1fb22a[_0x4bc638(0x310)]||'.'));else{if(_0x54f0cb===_0x4bc638(0x2cc))_0x89faf7[_0x4bc638(0x1e2)](_0x4bc638(0x1f3)+_0x1fb22a[_0x4bc638(0x310)]);else{if(_0x54f0cb===_0x4bc638(0x295))_0x89faf7[_0x4bc638(0x1e2)](_0x4bc638(0x1e4)+(_0x1fb22a[_0x4bc638(0x2b9)]||'.'));else{if(_0x54f0cb===_0x4bc638(0x255))_0x89faf7['push'](_0x4bc638(0x23c)+_0x1fb22a[_0x4bc638(0x2eb)]+'\x27\x20'+(_0x1fb22a[_0x4bc638(0x310)]||'.'));else _0x54f0cb==='finish'&&_0x89faf7[_0x4bc638(0x1e2)]('finish');}}}}catch{}}}return _0x89faf7;},_0xcb4fe0=_0x54a056=>{const _0x556bb9=_0x4492bc,_0x190380=[];if(!_0x54a056||!Array['isArray'](_0x54a056))return _0x190380;const _0x3569c4=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x556bb9(0x27f),'tool':_0x556bb9(0x2cc)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x556bb9(0x30f),'tool':_0x556bb9(0x2cc)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x556bb9(0x2c0),'tool':_0x556bb9(0x2cc)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x556bb9(0x265),'tool':_0x556bb9(0x270)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x556bb9(0x29f),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':_0x556bb9(0x2c0),'tool':_0x556bb9(0x2cc)},{'pattern':/\[SYMLINK\]/,'error_type':_0x556bb9(0x257),'tool':'read'},{'pattern':/not a text file/,'error_type':_0x556bb9(0x2c0),'tool':'read'},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x556bb9(0x2cc)},{'pattern':/Error reading file:/,'error_type':_0x556bb9(0x2f7),'tool':_0x556bb9(0x2cc)},{'pattern':/status="error"/,'error_type':_0x556bb9(0x2e0),'tool':_0x556bb9(0x2ba)}];let _0x557ef2=0x0;for(const _0x652997 of _0x54a056){_0x652997[_0x556bb9(0x261)]===_0x556bb9(0x224)&&Array[_0x556bb9(0x202)](_0x652997['tool_calls'])&&_0x557ef2++;const _0xce5755=_0x652997[_0x556bb9(0x2bf)];if((_0x652997[_0x556bb9(0x261)]===_0x556bb9(0x217)||_0x652997[_0x556bb9(0x261)]===_0x556bb9(0x2a2))&&_0xce5755&&typeof _0xce5755===_0x556bb9(0x2a6))for(const {pattern:_0x5f2b5e,error_type:_0x451bd7,tool:_0x882862}of _0x3569c4){const _0x2b6751=_0xce5755['match'](new RegExp(_0x5f2b5e[_0x556bb9(0x2b6)],'g'));if(_0x2b6751)for(const _0x4a5f33 of _0x2b6751){const _0x570ef1=_0xce5755[_0x556bb9(0x253)](_0x4a5f33),_0x40025a=_0xce5755[_0x556bb9(0x274)](_0x570ef1,Math[_0x556bb9(0x2b8)](_0x570ef1+0xc8,_0xce5755[_0x556bb9(0x2e2)]));_0x190380[_0x556bb9(0x1e2)]({'tool':_0x882862,'error_type':_0x451bd7,'error_message':_0x40025a[_0x556bb9(0x26f)]('\x0a')[0x0],'turn':_0x557ef2});}}}return _0x190380;};try{const _0x1b5ac3=a0_0x390fe1[_0x4492bc(0x24c)](_0x1e98d4['data']['repo_path']),_0x21d8bd=_0x1e98d4['data']['search_type'],_0x492c8b=_0x21d8bd==='node_modules'?{'allowNames':[_0x4492bc(0x284)]}:undefined,_0x61b80b=new LocalRipgrepProvider(_0x1b5ac3,undefined,_0x492c8b);logger['debug'](_0x4492bc(0x233),_0x4492bc(0x216),{'type':'LocalRipgrepProvider','repo_root':_0x1b5ac3,'search_type':_0x21d8bd||_0x4492bc(0x25e)}),logger[_0x4492bc(0x302)]('MCP',_0x4492bc(0x305),{'query':_0x1e98d4[_0x4492bc(0x2b1)][_0x4492bc(0x2ed)],'repo_root':_0x1b5ac3,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x1e5350=Date[_0x4492bc(0x2cb)](),_0xb9d435=await runWarpGrep({'searchTerm':_0x1e98d4[_0x4492bc(0x2b1)][_0x4492bc(0x2ed)],'repoRoot':_0x1b5ac3,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x61b80b,'search_type':_0x21d8bd}),_0x75b7c0=Date['now']()-_0x1e5350,_0x533101=_0xb9d435[_0x4492bc(0x28f)]?.['metadata']?.[_0x4492bc(0x1f9)]?.[_0x4492bc(0x2e2)]??0x0;logger['debug'](_0x4492bc(0x233),'warp_grep_complete',{'termination':_0xb9d435[_0x4492bc(0x290)],'turns':_0xb9d435[_0x4492bc(0x1fb)]?.[_0x4492bc(0x232)]??0x0,'files_found':_0x533101,'latency_ms':_0x75b7c0});const _0x36cf2a=_0xcb4fe0(_0xb9d435[_0x4492bc(0x2e9)]);_0x36cf2a[_0x4492bc(0x2e2)]>0x0&&reportMorphError({'error_message':_0x4492bc(0x21a)+_0x36cf2a['length']+_0x4492bc(0x2a8),'error_type':_0x4492bc(0x213),'level':'warn','tool':'codebase_search','context':{'repo_path':_0x1e98d4['data']['repo_path'],'query':_0x1e98d4[_0x4492bc(0x2b1)][_0x4492bc(0x2ed)],'model':'morph-warp-grep-v2.1','termination_reason':_0xb9d435[_0x4492bc(0x290)],'sub_tool_errors':_0x36cf2a,'timings':_0xb9d435[_0x4492bc(0x1fb)],'tool_calls':_0x573713(_0xb9d435[_0x4492bc(0x2e9)]),'messages':_0xb9d435[_0x4492bc(0x2e9)]?.[_0x4492bc(0x2d6)](_0x19b82d=>({'role':_0x19b82d[_0x4492bc(0x261)],'content':_0x19b82d[_0x4492bc(0x2bf)],..._0x19b82d['tool_calls']?{'tool_calls':_0x19b82d['tool_calls'][_0x4492bc(0x2e2)]}:{},..._0x19b82d[_0x4492bc(0x2b7)]?{'tool_call_id':_0x19b82d['tool_call_id']}:{}}))},'source':_0x4492bc(0x266)})[_0x4492bc(0x1ec)](()=>{});let _0x141909='';if(_0xb9d435[_0x4492bc(0x290)]===_0x4492bc(0x225)&&_0xb9d435[_0x4492bc(0x28f)]?.[_0x4492bc(0x2a5)]?.[_0x4492bc(0x1f9)]){const _0x35f3ab=_0xb9d435[_0x4492bc(0x28f)][_0x4492bc(0x2a5)][_0x4492bc(0x1f9)];if(_0x35f3ab[_0x4492bc(0x2e2)]===0x0)return _0x141909=_0xb9d435[_0x4492bc(0x28f)][_0x4492bc(0x1f5)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x4492bc(0x28c),'text':_0x141909}]};const _0x44d589=[],_0x49e85c=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0xcc7410 of _0xb9d435['messages']){if(_0xcc7410[_0x4492bc(0x261)]==='assistant'&&Array['isArray'](_0xcc7410[_0x4492bc(0x285)]))for(const _0x3a908e of _0xcc7410[_0x4492bc(0x285)]){try{const _0x428778=_0x3a908e[_0x4492bc(0x22c)]?.['name'],_0x122e94=JSON[_0x4492bc(0x271)](_0x3a908e[_0x4492bc(0x22c)]?.[_0x4492bc(0x24e)]||'{}');if(_0x428778==='grep_search')_0x49e85c[_0x4492bc(0x1e2)](_0x4492bc(0x293)+_0x122e94[_0x4492bc(0x2eb)]+'\x27\x20in\x20`'+(_0x122e94[_0x4492bc(0x310)]||'.')+'`');else{if(_0x428778===_0x4492bc(0x2cc))_0x49e85c['push'](_0x4492bc(0x289)+_0x122e94[_0x4492bc(0x310)]+'`');else{if(_0x428778===_0x4492bc(0x295))_0x49e85c[_0x4492bc(0x1e2)](_0x4492bc(0x1f1)+(_0x122e94[_0x4492bc(0x2b9)]||'.')+'`');else _0x428778===_0x4492bc(0x255)&&_0x49e85c[_0x4492bc(0x1e2)](_0x4492bc(0x276)+_0x122e94[_0x4492bc(0x2eb)]+'`\x20in\x20`'+(_0x122e94[_0x4492bc(0x310)]||'.')+'`');}}}catch{}}}_0x44d589[_0x4492bc(0x1e2)](_0x49e85c['join']('\x0a'));const _0x563e9f=['',_0x4492bc(0x2a0)];for(const _0x119964 of _0x35f3ab){if(_0x119964[_0x4492bc(0x22e)]==='*')_0x563e9f[_0x4492bc(0x1e2)]('-\x20'+_0x119964[_0x4492bc(0x310)]+':*');else{if(Array[_0x4492bc(0x202)](_0x119964['lines'])){const _0xc1704a=_0x119964[_0x4492bc(0x22e)][_0x4492bc(0x2d6)](([_0x32cc73,_0x55f459])=>{if(_0x32cc73===_0x55f459)return''+_0x32cc73;return _0x32cc73+'-'+_0x55f459;});_0x563e9f[_0x4492bc(0x1e2)]('-\x20'+_0x119964[_0x4492bc(0x310)]+':'+_0xc1704a[_0x4492bc(0x2cf)](','));}else _0x563e9f[_0x4492bc(0x1e2)]('-\x20'+_0x119964[_0x4492bc(0x310)]+':*');}}_0x563e9f[_0x4492bc(0x1e2)](''),_0x44d589['push'](_0x563e9f['join']('\x0a')),_0x44d589[_0x4492bc(0x1e2)](_0x4492bc(0x2ce));const _0x5c8a0c=[],_0x288e67=[];for(const _0x2f818e of _0x35f3ab){let _0x3cecd5=a0_0x390fe1[_0x4492bc(0x24c)](_0x1e98d4['data'][_0x4492bc(0x30d)],_0x2f818e['path']),_0x425634=null,_0x2efd74=null;try{_0x425634=await a0_0x1b5499[_0x4492bc(0x273)](_0x3cecd5,{'encoding':'utf-8'});}catch(_0xe6151){const _0x3cfa28=fixPathRepetition(_0x3cecd5);if(_0x3cfa28)try{_0x425634=await a0_0x1b5499[_0x4492bc(0x273)](_0x3cfa28,{'encoding':_0x4492bc(0x1e6)}),_0x3cecd5=_0x3cfa28;}catch{_0x2efd74=_0xe6151 instanceof Error?_0xe6151:new Error(String(_0xe6151));}else _0x2efd74=_0xe6151 instanceof Error?_0xe6151:new Error(String(_0xe6151));}if(_0x425634!==null){const _0x18db96=_0x425634[_0x4492bc(0x26f)](/\r?\n/),_0x24ddfc=[];if(_0x2f818e['lines']==='*'||!Array[_0x4492bc(0x202)](_0x2f818e[_0x4492bc(0x22e)]))for(let _0x429bd4=0x1;_0x429bd4<=_0x18db96[_0x4492bc(0x2e2)];_0x429bd4++){const _0x2891da=_0x18db96[_0x429bd4-0x1];_0x24ddfc[_0x4492bc(0x1e2)](_0x429bd4+'|\x20'+_0x2891da);}else for(const [_0x5dfbdc,_0x41adc1]of _0x2f818e[_0x4492bc(0x22e)]){_0x24ddfc[_0x4492bc(0x2e2)]>0x0&&_0x24ddfc[_0x4492bc(0x1e2)]('');for(let _0x10951b=_0x5dfbdc;_0x10951b<=_0x41adc1&&_0x10951b<=_0x18db96[_0x4492bc(0x2e2)];_0x10951b++){const _0x12c53f=_0x18db96[_0x10951b-0x1];_0x24ddfc['push'](_0x10951b+'|\x20'+_0x12c53f);}}_0x288e67[_0x4492bc(0x1e2)]({'path':_0x2f818e[_0x4492bc(0x310)],'content':_0x24ddfc[_0x4492bc(0x2cf)]('\x0a')});}else _0x5c8a0c['push'](_0x4492bc(0x304)+_0x2f818e['path']+_0x4492bc(0x241)+(_0x2efd74?.[_0x4492bc(0x20b)]||_0x4492bc(0x2f8))+'\x0a</file>');}try{const _0x34436f=await compactFileContexts(_0x288e67,_0x1e98d4['data'][_0x4492bc(0x2ed)],MORPH_API_KEY,MORPH_API_URL);for(const _0xb8fb21 of _0x34436f){_0x5c8a0c[_0x4492bc(0x1e2)](_0x4492bc(0x304)+_0xb8fb21[_0x4492bc(0x310)]+_0x4492bc(0x2f1)+_0xb8fb21['content']+_0x4492bc(0x24d));}}catch(_0x5227de){logger[_0x4492bc(0x25a)]('MCP',_0x4492bc(0x25d),{'error':_0x5227de instanceof Error?_0x5227de['message']:String(_0x5227de),'files_count':_0x288e67['length']});for(const _0x151c39 of _0x288e67){_0x5c8a0c[_0x4492bc(0x1e2)]('<file\x20path=\x22'+_0x151c39[_0x4492bc(0x310)]+'\x22>\x0a'+_0x151c39[_0x4492bc(0x2bf)]+'\x0a</file>');}}_0x44d589[_0x4492bc(0x1e2)](_0x5c8a0c[_0x4492bc(0x2cf)]('\x0a\x0a')),_0x141909=_0x44d589[_0x4492bc(0x2cf)]('\x0a');const _0xc722ba=_0xb9d435['errors']?.[_0x4492bc(0x254)](_0x29e735=>_0x29e735[_0x4492bc(0x20b)]?.[_0x4492bc(0x2c8)]('File\x20read\x20error:'))||[];if(_0xc722ba['length']>0x0){const _0x4dd627=_0xc722ba[_0x4492bc(0x2d6)](_0x274673=>_0x274673[_0x4492bc(0x20b)])[_0x4492bc(0x2cf)](';\x20');reportMorphError({'error_message':_0x4dd627,'error_type':_0x4492bc(0x29c),'context':{'tool':_0x4492bc(0x26d),'repo_path':_0x1e98d4[_0x4492bc(0x2b1)]['repo_path'],'query':_0x1e98d4[_0x4492bc(0x2b1)]['search_string'],'model':_0x4492bc(0x2b4),'termination_reason':_0x4492bc(0x1fc),'error_count':_0xc722ba[_0x4492bc(0x2e2)],'is_timeout':![],'timings':_0xb9d435[_0x4492bc(0x1fb)],'files_attempted':_0x35f3ab[_0x4492bc(0x2d6)](_0x511d4c=>({'path':_0x511d4c[_0x4492bc(0x310)],'lines':_0x511d4c['lines']})),'tool_calls':_0x573713(_0xb9d435[_0x4492bc(0x2e9)]),'messages':_0xb9d435[_0x4492bc(0x2e9)]?.[_0x4492bc(0x2d6)](_0x3b2db9=>({'role':_0x3b2db9[_0x4492bc(0x261)],'content':_0x3b2db9[_0x4492bc(0x2bf)],..._0x3b2db9[_0x4492bc(0x285)]?{'tool_calls':_0x3b2db9[_0x4492bc(0x285)][_0x4492bc(0x2e2)]}:{},..._0x3b2db9[_0x4492bc(0x2b7)]?{'tool_call_id':_0x3b2db9['tool_call_id']}:{}})),'request_content':{'query':_0x1e98d4[_0x4492bc(0x2b1)]['search_string'],'repo_path':_0x1e98d4[_0x4492bc(0x2b1)][_0x4492bc(0x30d)],'repoRoot':a0_0x390fe1[_0x4492bc(0x24c)](_0x1e98d4[_0x4492bc(0x2b1)]['repo_path']),'model':'morph-warp-grep-v2.1'}},'source':_0x4492bc(0x266)})[_0x4492bc(0x1ec)](()=>{});}}else{if(_0xb9d435[_0x4492bc(0x290)]===_0x4492bc(0x2ca)&&_0xb9d435['errors'][_0x4492bc(0x2e2)]>0x0){const _0x121ab4=_0xb9d435[_0x4492bc(0x25c)]['map'](_0x1f420d=>_0x1f420d[_0x4492bc(0x20b)])[_0x4492bc(0x2cf)](';\x20');_0x141909='Error:\x20'+_0x121ab4;const _0xd40a7d=_0x121ab4['toLowerCase']()[_0x4492bc(0x27b)](_0x4492bc(0x1e7))||_0x121ab4[_0x4492bc(0x222)]()[_0x4492bc(0x27b)](_0x4492bc(0x2d5))||_0x121ab4[_0x4492bc(0x222)]()[_0x4492bc(0x27b)](_0x4492bc(0x2a4)),_0x203c3d=_0xb9d435[_0x4492bc(0x28f)]?.[_0x4492bc(0x2a5)]?.[_0x4492bc(0x1f9)],_0x582c3e=_0xb9d435[_0x4492bc(0x25c)][0x0];reportMorphError({'error_message':_0x121ab4,'error_type':_0xd40a7d?'TimeoutError':_0x582c3e?.[_0x4492bc(0x298)]?.[_0x4492bc(0x21c)]||_0x4492bc(0x20d),'context':{'tool':'codebase_search','repo_path':_0x1e98d4[_0x4492bc(0x2b1)]['repo_path'],'query':_0x1e98d4[_0x4492bc(0x2b1)][_0x4492bc(0x2ed)],'model':_0x4492bc(0x2b4),'termination_reason':_0xb9d435[_0x4492bc(0x290)],'error_count':_0xb9d435['errors'][_0x4492bc(0x2e2)],'is_timeout':_0xd40a7d,'timings':_0xb9d435[_0x4492bc(0x1fb)],'files_attempted':_0x203c3d?.[_0x4492bc(0x2d6)](_0x391c60=>({'path':_0x391c60[_0x4492bc(0x310)],'lines':_0x391c60[_0x4492bc(0x22e)]})),'tool_calls':_0x573713(_0xb9d435[_0x4492bc(0x2e9)]),'messages':_0xb9d435[_0x4492bc(0x2e9)]?.['map'](_0x20cb32=>({'role':_0x20cb32[_0x4492bc(0x261)],'content':_0x20cb32[_0x4492bc(0x2bf)],..._0x20cb32[_0x4492bc(0x285)]?{'tool_calls':_0x20cb32[_0x4492bc(0x285)][_0x4492bc(0x2e2)]}:{},..._0x20cb32['tool_call_id']?{'tool_call_id':_0x20cb32[_0x4492bc(0x2b7)]}:{}})),'request_content':{'query':_0x1e98d4[_0x4492bc(0x2b1)][_0x4492bc(0x2ed)],'repo_path':_0x1e98d4['data']['repo_path'],'repoRoot':a0_0x390fe1['resolve'](_0x1e98d4[_0x4492bc(0x2b1)][_0x4492bc(0x30d)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x582c3e?.['stack']||undefined,'source':_0x4492bc(0x266)})[_0x4492bc(0x1ec)](()=>{});}else _0x141909=_0x4492bc(0x303);}return{'content':[{'type':_0x4492bc(0x28c),'text':_0x141909}]};}catch(_0x9b71e2){const _0x1d4718=handleMorphAPIError(_0x9b71e2);if(_0x1d4718)return logger[_0x4492bc(0x269)](_0x4492bc(0x233),'tool_call_error',{'tool':'codebase_search','error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x4492bc(0x2cb)]()-_0x2c4ec8}),_0x1d4718;const _0xca1b88=_0x9b71e2 instanceof Error?_0x9b71e2['message']:String(_0x9b71e2);logger[_0x4492bc(0x269)]('MCP',_0x4492bc(0x2be),{'tool':'codebase_search','error':_0xca1b88,'repo_path':_0x1e98d4[_0x4492bc(0x2b1)][_0x4492bc(0x30d)],'query':_0x1e98d4[_0x4492bc(0x2b1)][_0x4492bc(0x2ed)],'latency_ms':Date[_0x4492bc(0x2cb)]()-_0x2c4ec8});const _0x142611=_0xca1b88[_0x4492bc(0x222)]()['includes'](_0x4492bc(0x1e7))||_0xca1b88[_0x4492bc(0x222)]()[_0x4492bc(0x27b)](_0x4492bc(0x2d5))||_0xca1b88[_0x4492bc(0x222)]()['includes'](_0x4492bc(0x2a4))||_0x9b71e2 instanceof Error&&_0x9b71e2['name']===_0x4492bc(0x1e3);return reportMorphError({'error_message':_0xca1b88,'error_type':_0x142611?_0x4492bc(0x1e3):_0x9b71e2 instanceof Error?_0x9b71e2[_0x4492bc(0x298)]['name']:_0x4492bc(0x2ae),'context':{'tool':_0x4492bc(0x26d),'repo_path':_0x1e98d4[_0x4492bc(0x2b1)][_0x4492bc(0x30d)],'query':_0x1e98d4['data']['search_string'],'model':_0x4492bc(0x2b4),'is_timeout':_0x142611,'exception_phase':_0x4492bc(0x1e8),'request_content':{'query':_0x1e98d4['data'][_0x4492bc(0x2ed)],'repo_path':_0x1e98d4['data']['repo_path'],'repoRoot':a0_0x390fe1[_0x4492bc(0x24c)](_0x1e98d4[_0x4492bc(0x2b1)][_0x4492bc(0x30d)]),'model':_0x4492bc(0x2b4)}},'stack_trace':_0x9b71e2 instanceof Error?_0x9b71e2[_0x4492bc(0x246)]:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':'text','text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0xca1b88}],'isError':![]};}}case TOOL_NAMES[_0x4492bc(0x212)]:{const _0x4147b7=WarpGrepGitHubArgsSchema['safeParse'](_0x189e0b);if(!_0x4147b7[_0x4492bc(0x2f5)])return{'content':[{'type':_0x4492bc(0x28c),'text':_0x4492bc(0x1ed)+_0x4147b7[_0x4492bc(0x269)]}],'isError':!![]};const _0x164b78=_0x4147b7[_0x4492bc(0x2b1)]['github_url']||_0x4147b7[_0x4492bc(0x2b1)][_0x4492bc(0x2ee)];if(!_0x164b78)return{'content':[{'type':_0x4492bc(0x28c),'text':_0x4492bc(0x2ea)}],'isError':!![]};const _0x3d7013=MORPH_API_KEY;if(!_0x3d7013)throw new Error(_0x4492bc(0x2d7));const _0x5e7bbb=Date[_0x4492bc(0x2cb)]();logger[_0x4492bc(0x302)](_0x4492bc(0x233),_0x4492bc(0x2c5),{'identifier':_0x164b78,'query':_0x4147b7[_0x4492bc(0x2b1)][_0x4492bc(0x2ed)],'branch':_0x4147b7[_0x4492bc(0x2b1)][_0x4492bc(0x30c)]});try{const _0x17f940=new WarpGrepClient({'morphApiKey':_0x3d7013,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x32c82b=await _0x17f940[_0x4492bc(0x2c9)]({'searchTerm':_0x4147b7[_0x4492bc(0x2b1)]['search_string'],'github':_0x164b78,'branch':_0x4147b7[_0x4492bc(0x2b1)]['branch']}),_0x51abf0=Date[_0x4492bc(0x2cb)]()-_0x5e7bbb;logMcpStderr(_0x4492bc(0x245)+_0x51abf0+_0x4492bc(0x2c1)+_0x32c82b[_0x4492bc(0x2f5)]);const _0x2bd1e4=formatResult(_0x32c82b);return{'content':[{'type':_0x4492bc(0x28c),'text':_0x2bd1e4}]};}catch(_0x154c17){const _0x323838=handleMorphAPIError(_0x154c17);if(_0x323838)return _0x323838;const _0x1f9a91=Date[_0x4492bc(0x2cb)]()-_0x5e7bbb,_0x693805=_0x154c17 instanceof Error?_0x154c17['message']:String(_0x154c17);return logMcpStderr(_0x4492bc(0x28d)+_0x1f9a91+_0x4492bc(0x223),_0x693805),reportMorphError({'error_message':_0x693805,'error_type':_0x154c17 instanceof Error?_0x154c17[_0x4492bc(0x298)][_0x4492bc(0x21c)]:'UnknownError','context':{'tool':_0x4492bc(0x264),'github_url':_0x164b78,'search_string':_0x4147b7[_0x4492bc(0x2b1)][_0x4492bc(0x2ed)],'branch':_0x4147b7[_0x4492bc(0x2b1)]['branch']},'stack_trace':_0x154c17 instanceof Error?_0x154c17[_0x4492bc(0x246)]:undefined,'source':_0x4492bc(0x266),'tool':_0x4492bc(0x264),'latency_ms':_0x1f9a91})[_0x4492bc(0x1ec)](()=>{}),{'content':[{'type':_0x4492bc(0x28c),'text':_0x4492bc(0x2a9)+_0x693805}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x33ec73);}}catch(_0x486072){const _0x3aa603=_0x486072 instanceof Error?_0x486072[_0x4492bc(0x20b)]:String(_0x486072);return reportMorphError({'error_message':_0x3aa603,'error_type':_0x486072 instanceof Error?_0x486072[_0x4492bc(0x298)][_0x4492bc(0x21c)]:_0x4492bc(0x2ae),'context':{'tool':_0x33ec73,'arguments':_0x189e0b?JSON[_0x4492bc(0x2da)](_0x189e0b)[_0x4492bc(0x274)](0x0,0x1f4):undefined,'mcp_server_version':_0x4492bc(0x2e1)},'stack_trace':_0x486072 instanceof Error?_0x486072[_0x4492bc(0x246)]:undefined,'source':_0x4492bc(0x266)})[_0x4492bc(0x1ec)](()=>{}),{'content':[{'type':_0x4492bc(0x28c),'text':_0x4492bc(0x211)+_0x3aa603}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x58d520){const _0x33d193=a0_0x5035ba,_0x5487b8=await getValidRootDirectories(_0x58d520);if(_0x5487b8[_0x33d193(0x2e2)]>0x0)allowedDirectories=[..._0x5487b8],logMcpStderr(_0x33d193(0x250)+_0x5487b8[_0x33d193(0x2e2)]+_0x33d193(0x1f7));else{logMcpStderr(_0x33d193(0x2ad));if(ENABLE_WORKSPACE_MODE)try{const _0x1d7d33=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x1d7d33&&(allowedDirectories=[_0x1d7d33],logMcpStderr(_0x33d193(0x209)+_0x1d7d33));}catch(_0x26bb32){logMcpStderr(_0x33d193(0x214)+_0x26bb32);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x3cc250=a0_0x5035ba;try{const _0x566eb1=await server[_0x3cc250(0x2db)]();_0x566eb1&&_0x3cc250(0x2e6)in _0x566eb1&&await updateAllowedDirectoriesFromRoots(_0x566eb1[_0x3cc250(0x2e6)]);}catch(_0x35a56c){logMcpStderr(_0x3cc250(0x20f),_0x35a56c instanceof Error?_0x35a56c['message']:String(_0x35a56c));}}),server[a0_0x5035ba(0x21d)]=async()=>{const _0x577075=a0_0x5035ba,_0x22c7d6=server['getClientCapabilities']();if(_0x22c7d6?.['roots'])try{const _0x32bfbe=await server[_0x577075(0x2db)]();_0x32bfbe&&_0x577075(0x2e6)in _0x32bfbe?await updateAllowedDirectoriesFromRoots(_0x32bfbe[_0x577075(0x2e6)]):logMcpStderr(_0x577075(0x279));}catch(_0x529065){logMcpStderr(_0x577075(0x2f6),_0x529065 instanceof Error?_0x529065[_0x577075(0x20b)]:String(_0x529065));}else{if(allowedDirectories[_0x577075(0x2e2)]>0x0)logMcpStderr(_0x577075(0x215),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x577075(0x308));else throw new Error(_0x577075(0x2fe));}}};async function runServer(){const _0x23bd27=a0_0x5035ba,_0x187e6c=new StdioServerTransport();await server[_0x23bd27(0x294)](_0x187e6c),logMcpStderr(_0x23bd27(0x2aa)),allowedDirectories[_0x23bd27(0x2e2)]===0x0&&logMcpStderr(_0x23bd27(0x230));}runServer()[a0_0x5035ba(0x1ec)](_0x150e66=>{logMcpStderr('Fatal\x20error\x20running\x20server:',_0x150e66),process['exit'](0x1);});
|
package/dist/log-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a1_0x344a(_0x302d76,_0x17eae6){_0x302d76=_0x302d76-0x106;var _0x5059de=a1_0x5059();var _0x344a9c=_0x5059de[_0x302d76];return _0x344a9c;}var a1_0x58b133=a1_0x344a;(function(_0x4e7a59,_0x1086a5){var _0x1607eb=a1_0x344a,_0xc31adb=_0x4e7a59();while(!![]){try{var _0x51ca5a=parseInt(_0x1607eb(0x10e))/0x1*(parseInt(_0x1607eb(0x116))/0x2)+-parseInt(_0x1607eb(0x108))/0x3*(-parseInt(_0x1607eb(0x118))/0x4)+parseInt(_0x1607eb(0x106))/0x5*(parseInt(_0x1607eb(0x117))/0x6)+parseInt(_0x1607eb(0x115))/0x7*(-parseInt(_0x1607eb(0x112))/0x8)+-parseInt(_0x1607eb(0x10a))/0x9+parseInt(_0x1607eb(0x111))/0xa+-parseInt(_0x1607eb(0x10d))/0xb;if(_0x51ca5a===_0x1086a5)break;else _0xc31adb['push'](_0xc31adb['shift']());}catch(_0x5b7000){_0xc31adb['push'](_0xc31adb['shift']());}}}(a1_0x5059,0x27a4e));import a1_0x2c1589 from'os';function a1_0x5059(){var _0x5ed735=['82356LmOloB','Unknown','1065ijCcCi','error','21XGmhrR','Linux','1238184ArcKZy','win32','platform','5727205TDnrZt','1biYgvi','[os=','macOS','3169900OzpdtD','8XIdEFg','darwin','MCP','288939vTPyvB','636692pJcRmQ','2322fJqKqo'];a1_0x5059=function(){return _0x5ed735;};return a1_0x5059();}import{logger}from'./logger.js';export function getOperatingSystemType(_0x4b113e=a1_0x2c1589[a1_0x58b133(0x10c)]()){var _0x4b9df9=a1_0x58b133;switch(_0x4b113e){case _0x4b9df9(0x113):return _0x4b9df9(0x110);case _0x4b9df9(0x10b):return'Windows';case'linux':return _0x4b9df9(0x109);default:return _0x4b9df9(0x119);}}export function formatMcpLogMessage(_0x103bea,_0x2e7e76=a1_0x2c1589[a1_0x58b133(0x10c)]()){var _0x8c7a48=a1_0x58b133;return _0x8c7a48(0x10f)+getOperatingSystemType(_0x2e7e76)+']\x20'+_0x103bea;}export function logMcpStderr(_0x15da0c,..._0x342a3c){var _0x103ff3=a1_0x58b133;console[_0x103ff3(0x107)](formatMcpLogMessage(_0x15da0c),..._0x342a3c),logger['info'](_0x103ff3(0x114),_0x15da0c,_0x342a3c['length']?{'args':_0x342a3c['map'](_0x54c9ea=>String(_0x54c9ea))}:undefined);}
|
package/dist/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a2_0x2e7d(){const _0x22a14d=['64107InVVyl','info','MORPH_LOG_FILE','debug','_log','10635sEMJxl','enabled','6206732DSEQFv','42043302BqaSTu','2468ueckFT',']\x20[','484czdnwo','stringify','430jICxFg','fileStream','toISOString','enable','env','13797568zilUpT','isEnabled','error','warn','5220804ciiAuH'];a2_0x2e7d=function(){return _0x22a14d;};return a2_0x2e7d();}const a2_0x5d18ec=a2_0x5b5f;function a2_0x5b5f(_0x146320,_0x136433){_0x146320=_0x146320-0x6f;const _0x2e7d74=a2_0x2e7d();let _0x5b5f3a=_0x2e7d74[_0x146320];return _0x5b5f3a;}(function(_0x22fe7d,_0x5cf14f){const _0x5d4e18=a2_0x5b5f,_0x26a42a=_0x22fe7d();while(!![]){try{const _0x3d29b3=-parseInt(_0x5d4e18(0x81))/0x1*(parseInt(_0x5d4e18(0x7d))/0x2)+parseInt(_0x5d4e18(0x74))/0x3+parseInt(_0x5d4e18(0x7f))/0x4*(parseInt(_0x5d4e18(0x79))/0x5)+-parseInt(_0x5d4e18(0x73))/0x6+-parseInt(_0x5d4e18(0x7b))/0x7+-parseInt(_0x5d4e18(0x6f))/0x8+parseInt(_0x5d4e18(0x7c))/0x9;if(_0x3d29b3===_0x5cf14f)break;else _0x26a42a['push'](_0x26a42a['shift']());}catch(_0x5acadc){_0x26a42a['push'](_0x26a42a['shift']());}}}(a2_0x2e7d,0xe5068));import{createWriteStream}from'fs';class MorphLogger{[a2_0x5d18ec(0x7a)];['fileStream'];constructor(){const _0x48ae53=a2_0x5d18ec;this[_0x48ae53(0x7a)]=process[_0x48ae53(0x85)]['MORPH_DEBUG']==='1'||!!process[_0x48ae53(0x85)][_0x48ae53(0x76)];const _0x151729=process[_0x48ae53(0x85)][_0x48ae53(0x76)];this[_0x48ae53(0x82)]=_0x151729?createWriteStream(_0x151729,{'flags':'a'}):null;}[a2_0x5d18ec(0x77)](_0x4e18b7,_0x49f746,_0x252af2){const _0x4806b5=a2_0x5d18ec;this[_0x4806b5(0x78)](_0x4806b5(0x77),_0x4e18b7,_0x49f746,_0x252af2);}[a2_0x5d18ec(0x75)](_0x2d89e9,_0x2c0211,_0x46740b){const _0x50555c=a2_0x5d18ec;this[_0x50555c(0x78)](_0x50555c(0x75),_0x2d89e9,_0x2c0211,_0x46740b);}[a2_0x5d18ec(0x72)](_0x40a453,_0x38107e,_0x4ae01f){const _0xe059f4=a2_0x5d18ec;this[_0xe059f4(0x78)](_0xe059f4(0x72),_0x40a453,_0x38107e,_0x4ae01f);}[a2_0x5d18ec(0x71)](_0x5b947e,_0xbaafb1,_0x255884){const _0x3c6bc1=a2_0x5d18ec;this[_0x3c6bc1(0x78)](_0x3c6bc1(0x71),_0x5b947e,_0xbaafb1,_0x255884);}[a2_0x5d18ec(0x84)](){this['enabled']=!![];}get[a2_0x5d18ec(0x70)](){const _0x56e604=a2_0x5d18ec;return this[_0x56e604(0x7a)];}[a2_0x5d18ec(0x78)](_0x3eb414,_0x308a41,_0x4b41ff,_0x23d838){const _0x1571f1=a2_0x5d18ec;if(_0x3eb414!=='error'&&!this[_0x1571f1(0x7a)])return;const _0x4f4412=new Date()[_0x1571f1(0x83)](),_0x34ba17='['+_0x4f4412+_0x1571f1(0x7e)+_0x3eb414['toUpperCase']()+_0x1571f1(0x7e)+_0x308a41+']';console[_0x1571f1(0x71)](_0x23d838?_0x34ba17+'\x20'+_0x4b41ff+'\x20'+JSON[_0x1571f1(0x80)](_0x23d838):_0x34ba17+'\x20'+_0x4b41ff),this[_0x1571f1(0x82)]?.['write'](JSON['stringify']({'ts':_0x4f4412,'level':_0x3eb414,'component':_0x308a41,'msg':_0x4b41ff,..._0x23d838&&{'data':_0x23d838}})+'\x0a');}}export const logger=new MorphLogger();
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3e90c6,_0x40f540){const _0x2a3b66=a3_0x43b4,_0x3c2baa=_0x3e90c6();while(!![]){try{const _0x1df975=-parseInt(_0x2a3b66(0x17c))/0x1+-parseInt(_0x2a3b66(0x181))/0x2+-parseInt(_0x2a3b66(0x18a))/0x3+parseInt(_0x2a3b66(0x184))/0x4*(-parseInt(_0x2a3b66(0x18b))/0x5)+-parseInt(_0x2a3b66(0x187))/0x6*(parseInt(_0x2a3b66(0x188))/0x7)+parseInt(_0x2a3b66(0x18e))/0x8+parseInt(_0x2a3b66(0x17d))/0x9;if(_0x1df975===_0x40f540)break;else _0x3c2baa['push'](_0x3c2baa['shift']());}catch(_0x152e25){_0x3c2baa['push'](_0x3c2baa['shift']());}}}(a3_0x58cd,0x1a358));import a3_0x586bb7 from'path';function a3_0x58cd(){const _0x50b5a4=['test','8tDRIAK','/mnt/','replace','3198bISQAF','21tYaUvt','trim','74316WBeCIG','137310jUzJni','charAt','slice','1684968HlOUbL','match','121968qptXyO','2120751eexOfY','homedir','join','startsWith','271290cENicU','toUpperCase'];a3_0x58cd=function(){return _0x50b5a4;};return a3_0x58cd();}import a3_0x24a4a6 from'os';export function convertToWindowsPath(_0x330da4){const _0x41d2d1=a3_0x43b4;if(_0x330da4[_0x41d2d1(0x180)](_0x41d2d1(0x185))){const _0x17f802=_0x330da4['charAt'](0x5)[_0x41d2d1(0x182)](),_0x3704c5=_0x330da4['slice'](0x6)[_0x41d2d1(0x186)](/\//g,'\x5c');return _0x17f802+':'+_0x3704c5;}if(_0x330da4[_0x41d2d1(0x17b)](/^\/[a-zA-Z]\//)){const _0x47afce=_0x330da4[_0x41d2d1(0x18c)](0x1)['toUpperCase'](),_0x5e821d=_0x330da4[_0x41d2d1(0x18d)](0x2)[_0x41d2d1(0x186)](/\//g,'\x5c');return _0x47afce+':'+_0x5e821d;}if(_0x330da4[_0x41d2d1(0x17b)](/^[a-zA-Z]:/))return _0x330da4[_0x41d2d1(0x186)](/\//g,'\x5c');return _0x330da4;}function a3_0x43b4(_0x13241f,_0x2960f2){_0x13241f=_0x13241f-0x17b;const _0x58cd55=a3_0x58cd();let _0x43b482=_0x58cd55[_0x13241f];return _0x43b482;}export function normalizePath(_0xe176f2){const _0x5d6bb7=a3_0x43b4;_0xe176f2=_0xe176f2[_0x5d6bb7(0x189)]()[_0x5d6bb7(0x186)](/^["']|["']$/g,'');const _0x12e15e=_0xe176f2[_0x5d6bb7(0x180)]('/')&&!_0xe176f2[_0x5d6bb7(0x17b)](/^\/mnt\/[a-z]\//i)&&!_0xe176f2[_0x5d6bb7(0x17b)](/^\/[a-zA-Z]\//);if(_0x12e15e)return _0xe176f2[_0x5d6bb7(0x186)](/\/+/g,'/')['replace'](/\/+$/,'');_0xe176f2=convertToWindowsPath(_0xe176f2);if(_0xe176f2[_0x5d6bb7(0x180)]('\x5c\x5c')){let _0xb85314=_0xe176f2;_0xb85314=_0xb85314[_0x5d6bb7(0x186)](/^\\{2,}/,'\x5c\x5c');const _0xa6d9d5=_0xb85314['substring'](0x2)[_0x5d6bb7(0x186)](/\\\\/g,'\x5c');_0xe176f2='\x5c\x5c'+_0xa6d9d5;}else _0xe176f2=_0xe176f2['replace'](/\\\\/g,'\x5c');let _0x2996ce=a3_0x586bb7['normalize'](_0xe176f2);_0xe176f2[_0x5d6bb7(0x180)]('\x5c\x5c')&&!_0x2996ce['startsWith']('\x5c\x5c')&&(_0x2996ce='\x5c'+_0x2996ce);if(_0x2996ce[_0x5d6bb7(0x17b)](/^[a-zA-Z]:/)){let _0x4c8ea1=_0x2996ce[_0x5d6bb7(0x186)](/\//g,'\x5c');return/^[a-z]:/[_0x5d6bb7(0x183)](_0x4c8ea1)&&(_0x4c8ea1=_0x4c8ea1[_0x5d6bb7(0x18c)](0x0)['toUpperCase']()+_0x4c8ea1['slice'](0x1)),_0x4c8ea1;}return _0x2996ce[_0x5d6bb7(0x186)](/\//g,'\x5c');}export function expandHome(_0x4ad76a){const _0x2cd830=a3_0x43b4;if(_0x4ad76a[_0x2cd830(0x180)]('~/')||_0x4ad76a==='~')return a3_0x586bb7[_0x2cd830(0x17f)](a3_0x24a4a6[_0x2cd830(0x17e)](),_0x4ad76a['slice'](0x1));return _0x4ad76a;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a4_0x31c0(_0x4af36b,_0x39dc0e){_0x4af36b=_0x4af36b-0x146;const _0x173167=a4_0x1731();let _0x31c003=_0x173167[_0x4af36b];return _0x31c003;}(function(_0x5b086e,_0x52e135){const _0x42d9fa=a4_0x31c0,_0x542ff6=_0x5b086e();while(!![]){try{const _0x1b460f=-parseInt(_0x42d9fa(0x150))/0x1+parseInt(_0x42d9fa(0x159))/0x2*(-parseInt(_0x42d9fa(0x147))/0x3)+parseInt(_0x42d9fa(0x149))/0x4*(-parseInt(_0x42d9fa(0x14d))/0x5)+parseInt(_0x42d9fa(0x14f))/0x6*(parseInt(_0x42d9fa(0x14a))/0x7)+parseInt(_0x42d9fa(0x153))/0x8*(parseInt(_0x42d9fa(0x148))/0x9)+-parseInt(_0x42d9fa(0x157))/0xa*(parseInt(_0x42d9fa(0x151))/0xb)+-parseInt(_0x42d9fa(0x14e))/0xc*(-parseInt(_0x42d9fa(0x15c))/0xd);if(_0x1b460f===_0x52e135)break;else _0x542ff6['push'](_0x542ff6['shift']());}catch(_0x454283){_0x542ff6['push'](_0x542ff6['shift']());}}}(a4_0x1731,0x8cb57));import a4_0x505023 from'path';function a4_0x1731(){const _0x447117=['685vFloPl','2472flYtGL','17508kpVsAY','739843RjGQkx','1282182tflNmH','string','56grzhoy','length','isAbsolute','normalize','50yJyoCf','Path\x20must\x20be\x20absolute\x20after\x20normalization','1366TKJfWz','sep','some','75608qKBbRc','resolve','582qAKrji','653373QMXWtz','14956zKAjTA','2009XKnHeh','isArray','startsWith'];a4_0x1731=function(){return _0x447117;};return a4_0x1731();}export function isPathWithinAllowedDirectories(_0x159b78,_0x2bd9ad){const _0x54993=a4_0x31c0;if(typeof _0x159b78!==_0x54993(0x152)||!Array[_0x54993(0x14b)](_0x2bd9ad))return![];if(!_0x159b78||_0x2bd9ad[_0x54993(0x154)]===0x0)return![];if(_0x159b78['includes']('\x00'))return![];let _0x1c8848;try{_0x1c8848=a4_0x505023[_0x54993(0x146)](a4_0x505023['normalize'](_0x159b78));}catch{return![];}if(!a4_0x505023[_0x54993(0x155)](_0x1c8848))throw new Error(_0x54993(0x158));return _0x2bd9ad[_0x54993(0x15b)](_0x25755c=>{const _0x2697ae=_0x54993;if(typeof _0x25755c!=='string'||!_0x25755c)return![];if(_0x25755c['includes']('\x00'))return![];let _0x18aba2;try{_0x18aba2=a4_0x505023[_0x2697ae(0x146)](a4_0x505023[_0x2697ae(0x156)](_0x25755c));}catch{return![];}if(!a4_0x505023['isAbsolute'](_0x18aba2))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x1c8848===_0x18aba2)return!![];if(_0x18aba2===a4_0x505023[_0x2697ae(0x15a)])return _0x1c8848[_0x2697ae(0x14c)](a4_0x505023[_0x2697ae(0x15a)]);return _0x1c8848[_0x2697ae(0x14c)](_0x18aba2+a4_0x505023[_0x2697ae(0x15a)]);});}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xe66837,_0x3913a3){const _0x5c7b98=a5_0x5f05,_0x10ae0e=_0xe66837();while(!![]){try{const _0x1e4f03=parseInt(_0x5c7b98(0x1d9))/0x1+-parseInt(_0x5c7b98(0x1eb))/0x2*(parseInt(_0x5c7b98(0x1d6))/0x3)+-parseInt(_0x5c7b98(0x1e4))/0x4*(parseInt(_0x5c7b98(0x1e8))/0x5)+-parseInt(_0x5c7b98(0x1ea))/0x6+parseInt(_0x5c7b98(0x1d7))/0x7*(-parseInt(_0x5c7b98(0x1e3))/0x8)+-parseInt(_0x5c7b98(0x1e6))/0x9+parseInt(_0x5c7b98(0x1d8))/0xa;if(_0x1e4f03===_0x3913a3)break;else _0x10ae0e['push'](_0x10ae0e['shift']());}catch(_0x353965){_0x10ae0e['push'](_0x10ae0e['shift']());}}}(a5_0xb5e2,0xa1a6f));import{promises as a5_0x34e7dd}from'fs';function a5_0x5f05(_0x36f2f1,_0x366ebd){_0x36f2f1=_0x36f2f1-0x1d6;const _0xb5e22e=a5_0xb5e2();let _0x5f0519=_0xb5e22e[_0x36f2f1];return _0x5f0519;}import a5_0xa2403d from'path';function a5_0xb5e2(){const _0x1624dd=['7741881JhRsEo','message','6229865nBeIDJ','homedir','5044236AXoQqk','31934BPfPwl','\x20due\x20to\x20error:\x20','147UfqXWl','292810JtdNcb','42395650dRBMxq','1323073Pbotic','file://','realpath','invalid\x20path\x20or\x20inaccessible','Skipping\x20invalid\x20directory:\x20','resolve','isDirectory','slice','uri','Skipping\x20','224wQFlyt','4XTFcMX','non-directory\x20root'];a5_0xb5e2=function(){return _0x1624dd;};return a5_0xb5e2();}import a5_0x399319 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x581683){const _0x5b6f17=a5_0x5f05;try{const _0x2d3699=_0x581683['startsWith'](_0x5b6f17(0x1da))?_0x581683['slice'](0x7):_0x581683,_0x5d3801=_0x2d3699['startsWith']('~/')||_0x2d3699==='~'?a5_0xa2403d['join'](a5_0x399319[_0x5b6f17(0x1e9)](),_0x2d3699[_0x5b6f17(0x1e0)](0x1)):_0x2d3699,_0x2a4216=a5_0xa2403d[_0x5b6f17(0x1de)](_0x5d3801),_0x12d03d=await a5_0x34e7dd[_0x5b6f17(0x1db)](_0x2a4216);return normalizePath(_0x12d03d);}catch{return null;}}function formatDirectoryError(_0x3cf3e3,_0x257342,_0x4f0a34){const _0x1c9a60=a5_0x5f05;if(_0x4f0a34)return _0x1c9a60(0x1e2)+_0x4f0a34+':\x20'+_0x3cf3e3;const _0x366792=_0x257342 instanceof Error?_0x257342[_0x1c9a60(0x1e7)]:String(_0x257342);return _0x1c9a60(0x1dd)+_0x3cf3e3+_0x1c9a60(0x1ec)+_0x366792;}export async function getValidRootDirectories(_0x1fc685){const _0x462f7c=a5_0x5f05,_0x4dc986=[];for(const _0x12d86e of _0x1fc685){const _0x74bd02=await parseRootUri(_0x12d86e['uri']);if(!_0x74bd02){logMcpStderr(formatDirectoryError(_0x12d86e[_0x462f7c(0x1e1)],undefined,_0x462f7c(0x1dc)));continue;}try{const _0x1a2358=await a5_0x34e7dd['stat'](_0x74bd02);_0x1a2358[_0x462f7c(0x1df)]()?_0x4dc986['push'](_0x74bd02):logMcpStderr(formatDirectoryError(_0x74bd02,undefined,_0x462f7c(0x1e5)));}catch(_0xd02afd){logMcpStderr(formatDirectoryError(_0x74bd02,_0xd02afd));}}return _0x4dc986;}
|
package/dist/tool-definitions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a6_0x8341e0=a6_0x1afa;function a6_0xdbcf(){const _0x5a6b5a=['2929974BWZXQs','16005645AvpaxC','8gGMVeh','21OIMDMh','21284LBMFwX','11lseNwu','15945420qDovDF','51066642XKVzdI','1220rmEslA','2987061hPpbMG','values','154106BxYMwF','codebase_search'];a6_0xdbcf=function(){return _0x5a6b5a;};return a6_0xdbcf();}(function(_0x115b0b,_0x48dd62){const _0x304af9=a6_0x1afa,_0x43bfe6=_0x115b0b();while(!![]){try{const _0x128c67=parseInt(_0x304af9(0xf3))/0x1*(parseInt(_0x304af9(0xec))/0x2)+-parseInt(_0x304af9(0xea))/0x3+-parseInt(_0x304af9(0xf2))/0x4*(-parseInt(_0x304af9(0xf6))/0x5)+-parseInt(_0x304af9(0xee))/0x6*(parseInt(_0x304af9(0xf1))/0x7)+parseInt(_0x304af9(0xf0))/0x8*(-parseInt(_0x304af9(0xef))/0x9)+-parseInt(_0x304af9(0xf4))/0xa+parseInt(_0x304af9(0xf5))/0xb;if(_0x128c67===_0x48dd62)break;else _0x43bfe6['push'](_0x43bfe6['shift']());}catch(_0x583cbc){_0x43bfe6['push'](_0x43bfe6['shift']());}}}(a6_0xdbcf,0xe9154));function a6_0x1afa(_0x3bdc3f,_0x2eef3b){_0x3bdc3f=_0x3bdc3f-0xea;const _0xdbcfa7=a6_0xdbcf();let _0x1afac6=_0xdbcfa7[_0x3bdc3f];return _0x1afac6;}export const TOOL_NAMES={'EDIT_FILE':'edit_file','CODEBASE_SEARCH':a6_0x8341e0(0xed),'GITHUB_CODEBASE_SEARCH':'github_codebase_search'};export const ALL_TOOL_NAMES=Object[a6_0x8341e0(0xeb)](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.197",
|
|
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.187",
|
|
39
39
|
"@vscode/ripgrep": "^1.15.14",
|
|
40
40
|
"axios": "^1.6.0",
|
|
41
41
|
"chalk": "^5.3.0",
|