@morphllm/morphmcp 0.8.179 → 0.8.181
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_0x41e81a=a0_0x5961;(function(_0x40a204,_0x1d7060){const _0x4dfa97=a0_0x5961,_0x32d422=_0x40a204();while(!![]){try{const _0x10339d=-parseInt(_0x4dfa97(0x201))/0x1*(parseInt(_0x4dfa97(0x274))/0x2)+-parseInt(_0x4dfa97(0x239))/0x3+-parseInt(_0x4dfa97(0x1d4))/0x4+parseInt(_0x4dfa97(0x260))/0x5*(parseInt(_0x4dfa97(0x28e))/0x6)+parseInt(_0x4dfa97(0x243))/0x7+parseInt(_0x4dfa97(0x22e))/0x8+parseInt(_0x4dfa97(0x207))/0x9;if(_0x10339d===_0x1d7060)break;else _0x32d422['push'](_0x32d422['shift']());}catch(_0xb9b765){_0x32d422['push'](_0x32d422['shift']());}}}(a0_0x2138,0x8f6a9));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';function a0_0x5961(_0x1c0afc,_0x2b7db5){_0x1c0afc=_0x1c0afc-0x1bd;const _0x213888=a0_0x2138();let _0x5961d7=_0x213888[_0x1c0afc];return _0x5961d7;}import a0_0x5f2eb7 from'fs/promises';import a0_0x5863e0 from'path';import a0_0x486d97 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_0x58f79b from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x5968d7){const _0x4c749a=a0_0x5961,_0x26930c=_0x5968d7['split'](a0_0x5863e0['sep'])['filter'](Boolean);if(_0x26930c[_0x4c749a(0x2e3)]<0x2)return null;for(let _0x3b02cf=Math['floor'](_0x26930c[_0x4c749a(0x2e3)]/0x2);_0x3b02cf>=0x1;_0x3b02cf--){for(let _0x1044ed=0x0;_0x1044ed<=_0x26930c[_0x4c749a(0x2e3)]-0x2*_0x3b02cf;_0x1044ed++){const _0x15078e=_0x26930c['slice'](_0x1044ed,_0x1044ed+_0x3b02cf),_0x1bd5d5=_0x26930c[_0x4c749a(0x2a7)](_0x1044ed+_0x3b02cf,_0x1044ed+0x2*_0x3b02cf);if(_0x15078e[_0x4c749a(0x2cb)]((_0x37f0d7,_0x3b7aa7)=>_0x37f0d7===_0x1bd5d5[_0x3b7aa7])){const _0x56c934=[..._0x26930c['slice'](0x0,_0x1044ed),..._0x26930c[_0x4c749a(0x2a7)](_0x1044ed+_0x3b02cf)];return a0_0x5863e0[_0x4c749a(0x234)]+_0x56c934[_0x4c749a(0x21a)](a0_0x5863e0[_0x4c749a(0x234)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x1487d4=a0_0x5961;try{const _0xd8baf2=require(_0x1487d4(0x27d));return _0xd8baf2[_0x1487d4(0x29c)]??'unknown';}catch(_0x368868){return logMcpStderr(_0x1487d4(0x20a),_0x368868),'unknown';}}function printHelp(){const _0x432445=a0_0x5961;console[_0x432445(0x264)](_0x432445(0x23e)+getPackageVersion()),console[_0x432445(0x264)](_0x432445(0x2a5)),console['log'](_0x432445(0x2c4)),console[_0x432445(0x264)]('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console['log'](_0x432445(0x2b2)),console[_0x432445(0x264)](_0x432445(0x2e7)),console[_0x432445(0x264)](_0x432445(0x269)),console['log'](_0x432445(0x248)),console['log'](_0x432445(0x1ce));}const cliArgs=process[a0_0x41e81a(0x2d5)][a0_0x41e81a(0x2a7)](0x2),VERSION_FLAGS=new Set([a0_0x41e81a(0x2b9),'-v','-V']),HELP_FLAGS=new Set([a0_0x41e81a(0x26d),'-h']);cliArgs[a0_0x41e81a(0x262)](_0x5d517b=>VERSION_FLAGS[a0_0x41e81a(0x1db)](_0x5d517b))&&(console['log'](a0_0x41e81a(0x23e)+getPackageVersion()),process['exit'](0x0));cliArgs[a0_0x41e81a(0x262)](_0x351f6b=>HELP_FLAGS[a0_0x41e81a(0x1db)](_0x351f6b))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x263ede){const _0x42be35=a0_0x41e81a;for(let _0x3670b6=0x0;_0x3670b6<cliArgs[_0x42be35(0x2e3)];_0x3670b6++){const _0x53154f=cliArgs[_0x3670b6];if(_0x53154f['startsWith']('--'+_0x263ede+'='))return _0x53154f[_0x42be35(0x2a7)](('--'+_0x263ede+'=')['length']);if(_0x53154f==='--'+_0x263ede&&_0x3670b6+0x1<cliArgs['length'])return cliArgs[_0x3670b6+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x41e81a(0x1db)](arg)||HELP_FLAGS['has'](arg))continue;if(arg[a0_0x41e81a(0x211)](a0_0x41e81a(0x2be)))continue;if(arg===a0_0x41e81a(0x263)){i++;continue;}args[a0_0x41e81a(0x291)](arg);}const WORKSPACE_ROOT=process['env'][a0_0x41e81a(0x22c)]||process[a0_0x41e81a(0x233)][a0_0x41e81a(0x25a)]||process[a0_0x41e81a(0x2d8)](),ENABLE_WORKSPACE_MODE=process[a0_0x41e81a(0x233)]['ENABLE_WORKSPACE_MODE']!==a0_0x41e81a(0x276),MORPH_API_KEY=getCliArg(a0_0x41e81a(0x2ea))??process[a0_0x41e81a(0x233)][a0_0x41e81a(0x2bb)],MORPH_API_URL=process[a0_0x41e81a(0x233)][a0_0x41e81a(0x25b)],MORPH_LARGE_APPLY=process['env'][a0_0x41e81a(0x29b)]!==a0_0x41e81a(0x276),MORPH_WARP_GREP_TIMEOUT=process[a0_0x41e81a(0x233)][a0_0x41e81a(0x1c1)]?parseInt(process[a0_0x41e81a(0x233)]['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x41e81a(0x233)][a0_0x41e81a(0x253)]?new Set(process[a0_0x41e81a(0x233)][a0_0x41e81a(0x253)][a0_0x41e81a(0x21e)](',')[a0_0x41e81a(0x1bf)](_0x110bba=>_0x110bba[a0_0x41e81a(0x22b)]())[a0_0x41e81a(0x241)](_0x1aa895=>_0x1aa895[a0_0x41e81a(0x2e3)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x41e81a(0x2ca)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x41e81a(0x2ef)](a0_0x41e81a(0x294)+tool+'\x22.\x20Known\x20tools:\x20'+[...KNOWN_TOOL_NAMES][a0_0x41e81a(0x21a)](',\x20'));}console[a0_0x41e81a(0x2ef)](a0_0x41e81a(0x215)+[...DISABLED_TOOLS][a0_0x41e81a(0x21a)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x41e81a(0x220))&&!MORPH_API_KEY[a0_0x41e81a(0x211)]('morph-')&&logMcpStderr(a0_0x41e81a(0x2a4));async function reportMorphError(_0x196a0b){const _0x8ac1e=a0_0x41e81a;try{await a0_0x58f79b['post'](_0x8ac1e(0x26b),{..._0x196a0b,'timestamp':new Date()[_0x8ac1e(0x225)](),'source':_0x196a0b[_0x8ac1e(0x2d4)]||_0x8ac1e(0x1f1),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x196a0b['context']}},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x584a2a,_0x2754fb){const _0x1c45e1=a0_0x41e81a;if(_0x584a2a&&typeof _0x584a2a===_0x1c45e1(0x1c7)&&'status'in _0x584a2a)return _0x584a2a[_0x1c45e1(0x1fa)];if(_0x584a2a&&typeof _0x584a2a===_0x1c45e1(0x1c7)&&_0x1c45e1(0x25f)in _0x584a2a)return _0x584a2a[_0x1c45e1(0x25f)]?.['status'];const _0xead68d=_0x2754fb['match'](/\b(401|429)\b/);return _0xead68d?parseInt(_0xead68d[0x1],0xa):null;}function handleMorphAPIError(_0x380e0f){const _0x5fbb04=a0_0x41e81a,_0x52b7c9=_0x380e0f instanceof Error?_0x380e0f['message']:String(_0x380e0f),_0x4a84be=extractStatusCode(_0x380e0f,_0x52b7c9);switch(_0x4a84be){case 0x191:return{'content':[{'type':_0x5fbb04(0x278),'text':_0x5fbb04(0x232)}],'isError':!![]};case 0x1ad:return{'content':[{'type':'text','text':_0x5fbb04(0x1e2)}],'isError':!![]};default:return null;}}function a0_0x2138(){const _0x3a0864=['Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','toLowerCase','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','isDirectory','dirname','github_url','Parent\x20directory\x20does\x20not\x20exist:\x20','enum','ReadError','exit','Tool\x20\x22','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','indexOf','mcp-filesystem','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','composer.json','file_read_failed','Unknown\x20error','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','warp_grep_complete','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','api_request_start','status','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.','repo_path','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','terminationReason','\x22>\x0aError\x20reading\x20file:\x20','WarpGrepError','150047mfQlfW','tool_call_received','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','codebase_search','\x22>\x0a','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','2731932pxTePB','Cargo.toml','ToolException','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','number','search_string','morph-mcp','owner_repo','Failed\x20to\x20read\x20file:\x20','startsWith','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','.\x20Path:\x20','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','Disabled\x20tools:\x20','\x20disabled\x20via\x20DISABLED_TOOLS','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','setRequestHandler','lines','join','params','Specific\x20commit\x20hash\x20to\x20search','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','split','Repository\x20identifier','sk-','File\x20read\x20error:','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','grep\x20\x27','basename','toISOString','GITHUB_CODEBASE_SEARCH','`\x20in\x20`','function','\x0a</file>','getClientCapabilities','trim','WORKSPACE_ROOT','list_directory\x20','7806792OyVujk','read','tool','edit_file','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.','env','sep','TimeoutError','Example\x20format:\x0a','WarpGrep\x20sub-tool\x20errors:\x20','-\x20Listed\x20directory\x20`','1032042ETMDjG','resolve','code','target_file','tsconfig.json','@morphllm/morphmcp\x20','Morph\x20FastApply\x20failed\x20without\x20error\x20message','isArray','filter','timings','3726184cTUmQf','target_filepath','pyproject.toml','tool_calls','constructor','\x20\x20morph-mcp','tool_call_id','\x20error(s)','safeParse','search_type','\x20is\x20not\x20a\x20directory','Tool\x20','file','LocalRipgrepProvider','linesAdded','warp_grep_start','DISABLED_TOOLS','compaction_failed','morph-v3-large','arguments','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','PWD','MORPH_API_URL','finish','substring','pattern','response','19235YXBhec','glob','some','--api-key','log','success','API\x20error\x20(auth/rate-limit)','instruction','morph-','\x0aExamples:','catch','https://morphllm.com/api/error-report','Created\x20File','--help','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','requiresApiKey','optional','-\x20Read\x20file\x20`',',\x20modified\x20','FileNotFound','14EGpZSc','\x20-\x20','false','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','text','normalize','Invalid\x20arguments:\x20','debug','linesModified','../package.json','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','now','data','role','PathError','name','file_path','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','filePath','errors','listRoots',',\x20removed\x20','Parameters:\x0a','stack','warn','588bTnSOG','GitHub\x20search\x20failed:\x20','match','push','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','morph-v3-fast','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','github_codebase_search','.\x20Changes:\x20','dryRun','❌\x20Morph\x20Edit\x20Failed:\x20','assistant','MORPH_LARGE_APPLY','version','\x20chars)','terminated','utf-8','BinaryFile','node_modules','provider_created','CODEBASE_SEARCH','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','\x20as\x20allowed\x20directory','slice','array','parse','MCP','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Fatal\x20error\x20running\x20server:','describe','roots','branch','payload','ENOENT','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','[github_codebase_search]\x20Done\x20in\x20','Applied','instructions','user','Error:\x20','command','--version','\x27\x20in\x20`','MORPH_API_KEY','SymlinkError','homedir','--api-key=','stringify','files','package.json','readFile','Max\x20results\x20to\x20return','\x0aOptions:','completed_with_file_errors','FileReadError','access','tool_call_error','setNotificationHandler','size','every','unknown','linesRemoved','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','metadata','go.mod','runWarpGrep_call','string','path_validation_resolved','source','argv','grep','messages','cwd','new_string','tool_call_complete','file_read_complete','added\x20','glob\x20\x27','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.','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','etimedout','Here\x20is\x20the\x20content\x20of\x20files:\x0a','edit','length','inputSchema','content','Failed\x20to\x20request\x20roots\x20from\x20client:','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','EDIT_FILE','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','api-key','Error\x20running\x20fast\x20context\x20search:\x20','A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20','**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','message','error','default','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.','stat','path','map','path_validation_failed','MORPH_WARP_GREP_TIMEOUT','<file\x20path=\x22','UnknownError','unknown\x20error','all','includes','object','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','list_directory','.git','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','Workspace\x20mode\x20enabled:\x20Using\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','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.','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','ms:','RipgrepNotAvailable','read\x20','827756UbrNbU','grep_search','code_edit','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','timeout','connect','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','has','morph-warp-grep-v2.1','oninitialized','ms.\x20Success:\x20','.vscode','[github_codebase_search]\x20Failed\x20in\x20','timed\x20out','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','github_search_start'];a0_0x2138=function(){return _0x3a0864;};return a0_0x2138();}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x41e81a(0x1c8)),logMcpStderr(a0_0x41e81a(0x1e4)),logMcpStderr(a0_0x41e81a(0x20b)),logMcpStderr(a0_0x41e81a(0x2ce)),logMcpStderr(a0_0x41e81a(0x1f6)),logMcpStderr(a0_0x41e81a(0x1cb)));function normalizePath(_0x512267){const _0x148085=a0_0x41e81a;return a0_0x5863e0[_0x148085(0x279)](_0x512267);}function expandHome(_0x3c621b){const _0x2bd137=a0_0x41e81a;if(_0x3c621b['startsWith']('~/')||_0x3c621b==='~')return a0_0x5863e0[_0x2bd137(0x21a)](a0_0x486d97[_0x2bd137(0x2bd)](),_0x3c621b[_0x2bd137(0x2a7)](0x1));return _0x3c621b;}let allowedDirectories=await Promise[a0_0x41e81a(0x1c5)](args[a0_0x41e81a(0x1bf)](async _0x350e94=>{const _0x47bad9=expandHome(_0x350e94),_0x1a6cb3=a0_0x5863e0['resolve'](_0x47bad9);try{const _0x2a50ac=await a0_0x5f2eb7['realpath'](_0x1a6cb3);return normalizePath(_0x2a50ac);}catch(_0x109a92){return normalizePath(_0x1a6cb3);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x41e81a(0x291)](workspaceDir),logMcpStderr(a0_0x41e81a(0x1cc)+workspaceDir+a0_0x41e81a(0x2a6)));}catch(a0_0xc19f20){logMcpStderr(a0_0x41e81a(0x27e)+a0_0xc19f20);}async function detectWorkspaceRoot(_0x7212cf){const _0x1040ec=a0_0x41e81a;let _0x465dc1=a0_0x5863e0[_0x1040ec(0x23a)](_0x7212cf);const _0x27b2f9=[_0x1040ec(0x1ca),_0x1040ec(0x1df),_0x1040ec(0x2c1),_0x1040ec(0x208),_0x1040ec(0x245),_0x1040ec(0x2d0),'.cursor',_0x1040ec(0x23d),_0x1040ec(0x1f3)];while(_0x465dc1!==a0_0x5863e0[_0x1040ec(0x1e8)](_0x465dc1)){for(const _0x350603 of _0x27b2f9){const _0xd8297c=a0_0x5863e0['join'](_0x465dc1,_0x350603);try{return await a0_0x5f2eb7[_0x1040ec(0x2c7)](_0xd8297c),normalizePath(_0x465dc1);}catch{}}_0x465dc1=a0_0x5863e0[_0x1040ec(0x1e8)](_0x465dc1);}return normalizePath(_0x7212cf);}await Promise[a0_0x41e81a(0x1c5)](args['map'](async _0x2b4c7d=>{const _0x1ebda5=a0_0x41e81a;try{const _0x54fa3c=await a0_0x5f2eb7[_0x1ebda5(0x1bd)](expandHome(_0x2b4c7d));!_0x54fa3c[_0x1ebda5(0x1e7)]()&&(logMcpStderr('Error:\x20'+_0x2b4c7d+_0x1ebda5(0x24d)),process['exit'](0x1));}catch(_0x1024c0){logMcpStderr('Error\x20accessing\x20directory\x20'+_0x2b4c7d+':',_0x1024c0),process[_0x1ebda5(0x1ed)](0x1);}}));async function validatePath(_0x810312){const _0x42b7f1=a0_0x41e81a,_0x45121d=expandHome(_0x810312),_0xefbaa5=a0_0x5863e0[_0x42b7f1(0x23a)](_0x45121d);logger[_0x42b7f1(0x27b)]('MCP','path_validation_start',{'raw_path':_0x810312,'absolute':_0xefbaa5});try{const _0x505070=await a0_0x5f2eb7['realpath'](_0xefbaa5);return logger[_0x42b7f1(0x27b)]('MCP',_0x42b7f1(0x2d3),{'resolved':_0x505070,'symlink':_0x505070!==_0xefbaa5}),_0x505070;}catch(_0xd9f3eb){if(_0xd9f3eb[_0x42b7f1(0x23b)]==='ENOENT'){const _0x4bd1df=a0_0x5863e0['dirname'](_0xefbaa5);try{const _0x371d02=await a0_0x5f2eb7['realpath'](_0x4bd1df),_0x9d74f3=a0_0x5863e0[_0x42b7f1(0x21a)](_0x371d02,a0_0x5863e0[_0x42b7f1(0x224)](_0xefbaa5));return logger[_0x42b7f1(0x27b)]('MCP',_0x42b7f1(0x2d3),{'resolved':_0x9d74f3,'new_file':!![]}),_0x9d74f3;}catch{logger[_0x42b7f1(0x2ef)](_0x42b7f1(0x2aa),_0x42b7f1(0x1c0),{'raw_path':_0x810312,'error':_0x42b7f1(0x1ea)+_0x4bd1df});throw new Error(_0x42b7f1(0x1ea)+_0x4bd1df);}}logger['error']('MCP','path_validation_failed',{'raw_path':_0x810312,'error':_0xd9f3eb[_0x42b7f1(0x2ee)]});throw _0xd9f3eb;}}const MorphEditFileArgsSchema=z[a0_0x41e81a(0x1c7)]({'path':z[a0_0x41e81a(0x2d2)](),'code_edit':z[a0_0x41e81a(0x2d2)]()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x259)),'instruction':z['string']()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x285)),'dryRun':z['boolean']()[a0_0x41e81a(0x2f0)](![])['describe']('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x41e81a(0x2f1),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x41e81a(0x2d2)]()[a0_0x41e81a(0x2ad)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x203)),'search_type':z[a0_0x41e81a(0x1eb)]([a0_0x41e81a(0x2f0),'node_modules'])['optional']()['describe'](a0_0x41e81a(0x206))}),WarpGrepGitHubArgsSchema=z[a0_0x41e81a(0x1c7)]({'search_string':z['string']()[a0_0x41e81a(0x2ad)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x41e81a(0x2d2)]()[a0_0x41e81a(0x270)]()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x2de)),'owner_repo':z[a0_0x41e81a(0x2d2)]()[a0_0x41e81a(0x270)]()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x2e9)),'branch':z[a0_0x41e81a(0x2d2)]()[a0_0x41e81a(0x270)]()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x286))}),CodebaseSearchArgsSchema=z[a0_0x41e81a(0x1c7)]({'query':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x21f)),'branch':z[a0_0x41e81a(0x2d2)]()['optional']()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x222)),'commitHash':z[a0_0x41e81a(0x2d2)]()[a0_0x41e81a(0x270)]()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x21c)),'targetDirectories':z[a0_0x41e81a(0x2a8)](z[a0_0x41e81a(0x2d2)]())[a0_0x41e81a(0x2f0)]([])[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x2ab)),'limit':z[a0_0x41e81a(0x20c)]()[a0_0x41e81a(0x270)]()[a0_0x41e81a(0x2f0)](0xa)[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x2c3))}),server=new Server({'name':a0_0x41e81a(0x20e),'version':'0.2.0'},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x4dcca2=a0_0x41e81a,_0xa6becd=[{'name':TOOL_NAMES[_0x4dcca2(0x2e8)],'description':_0x4dcca2(0x2ed)+_0x4dcca2(0x28b)+_0x4dcca2(0x1fd)+_0x4dcca2(0x292)+_0x4dcca2(0x257)+_0x4dcca2(0x212)+_0x4dcca2(0x236)+_0x4dcca2(0x1da)+'Rules:\x0a'+'-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a'+'-\x20Preserve\x20exact\x20indentation\x0a'+_0x4dcca2(0x1d7)+_0x4dcca2(0x214),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES['CODEBASE_SEARCH'],'description':_0x4dcca2(0x2ec)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x4dcca2(0x2df)+_0x4dcca2(0x277)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x17268c=_0xa6becd[_0x4dcca2(0x241)](_0x25362a=>{const _0x3174b8=_0x4dcca2;if(DISABLED_TOOLS[_0x3174b8(0x1db)](_0x25362a[_0x3174b8(0x283)]))return console['error'](_0x3174b8(0x24e)+_0x25362a[_0x3174b8(0x283)]+_0x3174b8(0x216)),![];if(_0x3174b8(0x26f)in _0x25362a&&_0x25362a[_0x3174b8(0x26f)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x25362a[_0x3174b8(0x283)]+_0x3174b8(0x1e6)),![];return!![];});return{'tools':_0x17268c[_0x4dcca2(0x1bf)](_0x5ebdca=>({'name':_0x5ebdca['name'],'description':_0x5ebdca['description'],'inputSchema':_0x5ebdca[_0x4dcca2(0x2e4)]}))};}),server[a0_0x41e81a(0x218)](CallToolRequestSchema,async _0x1b7bc7=>{const _0x5a09d5=a0_0x41e81a,{name:_0x5f498c,arguments:_0x363cd2}=_0x1b7bc7[_0x5a09d5(0x21b)],_0x175270=Date[_0x5a09d5(0x27f)]();logger[_0x5a09d5(0x27b)](_0x5a09d5(0x2aa),_0x5a09d5(0x202),{'tool':_0x5f498c,'args':_0x5f498c===_0x5a09d5(0x231)?{'path':_0x363cd2?.[_0x5a09d5(0x1be)],'instruction':_0x363cd2?.[_0x5a09d5(0x267)]||_0x363cd2?.[_0x5a09d5(0x2b5)],'dryRun':_0x363cd2?.[_0x5a09d5(0x298)]}:_0x363cd2});try{if(!MORPH_API_KEY)return{'content':[{'type':'text','text':_0x5a09d5(0x1ef)}],'isError':!![]};if(!MORPH_API_KEY[_0x5a09d5(0x211)]('sk-')&&!MORPH_API_KEY[_0x5a09d5(0x211)](_0x5a09d5(0x268)))return{'content':[{'type':_0x5a09d5(0x278),'text':_0x5a09d5(0x1fb)}],'isError':!![]};if(DISABLED_TOOLS[_0x5a09d5(0x1db)](_0x5f498c))return{'content':[{'type':_0x5a09d5(0x278),'text':_0x5a09d5(0x1ee)+_0x5f498c+_0x5a09d5(0x1d0)}],'isError':![]};switch(_0x5f498c){case TOOL_NAMES[_0x5a09d5(0x2e8)]:{let _0x37571f=_0x363cd2;if(_0x37571f&&typeof _0x37571f===_0x5a09d5(0x1c7)){if(!('path'in _0x37571f)){const _0x262ec4=_0x37571f[_0x5a09d5(0x23c)]??_0x37571f[_0x5a09d5(0x287)]??_0x37571f[_0x5a09d5(0x244)]??_0x37571f[_0x5a09d5(0x284)]??_0x37571f[_0x5a09d5(0x24f)];if(_0x262ec4)_0x37571f={..._0x37571f,'path':_0x262ec4};}'instructions'in _0x37571f&&!(_0x5a09d5(0x267)in _0x37571f)&&(_0x37571f={..._0x37571f,'instruction':_0x37571f['instructions']});if(!('code_edit'in _0x37571f)){const _0x47dbf9=_0x37571f['code']??_0x37571f[_0x5a09d5(0x2d9)]??_0x37571f['content']??_0x37571f[_0x5a09d5(0x2e2)];if(_0x47dbf9)_0x37571f={..._0x37571f,'code_edit':_0x47dbf9};}}const _0x5a7668=MorphEditFileArgsSchema[_0x5a09d5(0x24b)](_0x37571f);if(!_0x5a7668[_0x5a09d5(0x265)])throw new Error(_0x5a09d5(0x1f8)+_0x5a7668[_0x5a09d5(0x2ef)]);const _0x2bf757=await validatePath(_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x1be)]);let _0x15caf3=null,_0x6d560a=!![],_0x209960=null;try{_0x15caf3=await a0_0x5f2eb7[_0x5a09d5(0x2c2)](_0x2bf757,_0x5a09d5(0x29f)),logger[_0x5a09d5(0x27b)](_0x5a09d5(0x2aa),_0x5a09d5(0x2db),{'path':_0x2bf757,'size_bytes':_0x15caf3['length']});}catch(_0x5af592){const _0x374cc5=_0x5af592[_0x5a09d5(0x23b)];_0x374cc5===_0x5a09d5(0x2b1)?(_0x6d560a=![],_0x15caf3='',logger[_0x5a09d5(0x27b)](_0x5a09d5(0x2aa),_0x5a09d5(0x2db),{'path':_0x2bf757,'exists':![]})):(_0x209960=_0x5a09d5(0x210)+(_0x374cc5||'unknown')+_0x5a09d5(0x275)+(_0x5af592 instanceof Error?_0x5af592[_0x5a09d5(0x2ee)]:String(_0x5af592)),logger[_0x5a09d5(0x2ef)](_0x5a09d5(0x2aa),_0x5a09d5(0x1f4),{'path':_0x2bf757,'error':_0x209960}),logMcpStderr('Warning:\x20'+_0x209960));}let _0x1d83ce;try{const _0x3bbea6=MORPH_API_KEY;if(!_0x3bbea6)throw new Error(_0x5a09d5(0x26e));const _0x5dfeb6=a0_0x5863e0[_0x5a09d5(0x1e8)](_0x2bf757),_0x1bad32=a0_0x5863e0[_0x5a09d5(0x224)](_0x2bf757);logger['debug'](_0x5a09d5(0x2aa),_0x5a09d5(0x1f9),{'model':_0x5a09d5(0x293),'path':_0x5a7668['data'][_0x5a09d5(0x1be)],'instruction_len':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x267)][_0x5a09d5(0x2e3)],'code_edit_len':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x1d6)][_0x5a09d5(0x2e3)],'original_code_len':_0x15caf3?.[_0x5a09d5(0x2e3)]??0x0,'dry_run':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x298)]});const _0x562087=Date[_0x5a09d5(0x27f)](),_0x32c61a=await executeEditFile({'target_filepath':_0x1bad32,'code_edit':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x1d6)],'instruction':_0x5a7668['data'][_0x5a09d5(0x267)]},{'morphApiKey':_0x3bbea6,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x5dfeb6,'autoWrite':!_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x298)],'generateUdiff':![],'debug':![]}),_0x5821ce=Date['now']()-_0x562087;_0x1d83ce=_0x32c61a['completionId'];if(!_0x32c61a['success'])throw new Error(_0x32c61a[_0x5a09d5(0x2ef)]||_0x5a09d5(0x23f));const _0x41518b=_0x32c61a['changes'],_0x59b11b=_0x5a09d5(0x2dc)+_0x41518b[_0x5a09d5(0x251)]+_0x5a09d5(0x28a)+_0x41518b[_0x5a09d5(0x2cd)]+_0x5a09d5(0x272)+_0x41518b[_0x5a09d5(0x27c)];logger[_0x5a09d5(0x27b)](_0x5a09d5(0x2aa),_0x5a09d5(0x2da),{'tool':_0x5a09d5(0x231),'success':!![],'latency_ms':Date['now']()-_0x175270,'edit_latency_ms':_0x5821ce,'changes':{'added':_0x41518b[_0x5a09d5(0x251)],'removed':_0x41518b[_0x5a09d5(0x2cd)],'modified':_0x41518b['linesModified']},'completion_id':_0x1d83ce});if(_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x298)])return{'content':[{'type':_0x5a09d5(0x278),'text':'Morph\x20Edit\x20Preview'+(_0x6d560a?'':'\x20(new\x20file)')+':\x20'+_0x5a7668[_0x5a09d5(0x280)]['instruction']+_0x5a09d5(0x297)+_0x59b11b+'.\x20Path:\x20'+_0x5a7668['data'][_0x5a09d5(0x1be)]+'.'}]};return{'content':[{'type':_0x5a09d5(0x278),'text':'Morph\x20Edit\x20'+(_0x6d560a?_0x5a09d5(0x2b4):_0x5a09d5(0x26c))+':\x20'+_0x5a7668['data'][_0x5a09d5(0x267)]+'.\x20Changes:\x20'+_0x59b11b+_0x5a09d5(0x213)+_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x1be)]+'.'}]};}catch(_0x1650c7){const _0x5db0dd=handleMorphAPIError(_0x1650c7);if(_0x5db0dd)return logger[_0x5a09d5(0x2ef)](_0x5a09d5(0x2aa),_0x5a09d5(0x2c8),{'tool':_0x5a09d5(0x231),'error':_0x5a09d5(0x266),'latency_ms':Date['now']()-_0x175270}),_0x5db0dd;const _0x484e12=_0x1650c7 instanceof Error?_0x1650c7[_0x5a09d5(0x2ee)]:String(_0x1650c7);return logger[_0x5a09d5(0x2ef)](_0x5a09d5(0x2aa),'tool_call_error',{'tool':_0x5a09d5(0x231),'error':_0x484e12,'path':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x1be)],'validated_path':_0x2bf757,'latency_ms':Date['now']()-_0x175270,'stack':_0x1650c7 instanceof Error?_0x1650c7[_0x5a09d5(0x28c)]:undefined}),reportMorphError({'error_message':_0x484e12,'error_type':_0x1650c7 instanceof Error?_0x1650c7[_0x5a09d5(0x247)][_0x5a09d5(0x283)]:_0x5a09d5(0x1c3),'context':{'tool':'edit_file','completion_id':_0x1d83ce,'file_path':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x1be)],'validated_path':_0x2bf757,'instruction':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x267)],'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x5a09d5(0x293),'dry_run':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x298)],'file_exists':_0x6d560a,'file_read_error':_0x209960,'file_readable':_0x15caf3!==null,'request_content':{'path':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x1be)],'code_edit':_0x5a7668[_0x5a09d5(0x280)]['code_edit'],'instruction':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x267)],'original_code':_0x15caf3!==null?_0x15caf3[_0x5a09d5(0x2e3)]>0xc350?_0x15caf3[_0x5a09d5(0x25d)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x15caf3[_0x5a09d5(0x2e3)]+_0x5a09d5(0x29d):_0x15caf3:'[could\x20not\x20read\x20file:\x20'+(_0x209960||_0x5a09d5(0x1c4))+']','original_code_length':_0x15caf3?.[_0x5a09d5(0x2e3)]??0x0,'model':MORPH_LARGE_APPLY?_0x5a09d5(0x255):_0x5a09d5(0x293),'dry_run':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x298)]}},'stack_trace':_0x1650c7 instanceof Error?_0x1650c7[_0x5a09d5(0x28c)]:undefined,'source':_0x5a09d5(0x1f1)})[_0x5a09d5(0x26a)](()=>{}),{'content':[{'type':_0x5a09d5(0x278),'text':_0x5a09d5(0x299)+_0x484e12}],'isError':!![]};}}case TOOL_NAMES[_0x5a09d5(0x2a3)]:{const _0xb4eafb=WarpGrepArgsSchema[_0x5a09d5(0x24b)](_0x363cd2);if(!_0xb4eafb[_0x5a09d5(0x265)])return{'content':[{'type':_0x5a09d5(0x278),'text':_0x5a09d5(0x27a)+_0xb4eafb[_0x5a09d5(0x2ef)]}],'isError':!![]};const _0x3ca5e0=_0x3a3414=>{const _0x4dc684=_0x5a09d5,_0x4dbeb2=[];for(const _0x101b0e of _0x3a3414||[]){if(_0x101b0e['role']===_0x4dc684(0x29a)&&Array[_0x4dc684(0x240)](_0x101b0e[_0x4dc684(0x246)]))for(const _0x237071 of _0x101b0e['tool_calls']){try{const _0x3e44bc=_0x237071[_0x4dc684(0x228)]?.[_0x4dc684(0x283)],_0x549602=JSON[_0x4dc684(0x2a9)](_0x237071[_0x4dc684(0x228)]?.[_0x4dc684(0x256)]||'{}');if(_0x3e44bc===_0x4dc684(0x1d5))_0x4dbeb2[_0x4dc684(0x291)](_0x4dc684(0x223)+_0x549602[_0x4dc684(0x25e)]+'\x27\x20'+(_0x549602[_0x4dc684(0x1be)]||'.'));else{if(_0x3e44bc===_0x4dc684(0x22f))_0x4dbeb2[_0x4dc684(0x291)](_0x4dc684(0x1d3)+_0x549602['path']);else{if(_0x3e44bc===_0x4dc684(0x1c9))_0x4dbeb2[_0x4dc684(0x291)](_0x4dc684(0x22d)+(_0x549602['command']||'.'));else{if(_0x3e44bc===_0x4dc684(0x261))_0x4dbeb2['push'](_0x4dc684(0x2dd)+_0x549602['pattern']+'\x27\x20'+(_0x549602[_0x4dc684(0x1be)]||'.'));else _0x3e44bc==='finish'&&_0x4dbeb2[_0x4dc684(0x291)](_0x4dc684(0x25c));}}}}catch{}}}return _0x4dbeb2;},_0x2f5026=_0x4a2c4d=>{const _0x225eda=_0x5a09d5,_0xbb72c0=[];if(!_0x4a2c4d||!Array[_0x225eda(0x240)](_0x4a2c4d))return _0xbb72c0;const _0x37d39a=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x225eda(0x273),'tool':_0x225eda(0x22f)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x225eda(0x282),'tool':_0x225eda(0x22f)},{'pattern':/\[READ ERROR\]/,'error_type':_0x225eda(0x1ec),'tool':_0x225eda(0x22f)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x225eda(0x22f)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x225eda(0x1d2),'tool':_0x225eda(0x2d6)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x225eda(0x2a0),'tool':_0x225eda(0x22f)},{'pattern':/\[SYMLINK\]/,'error_type':_0x225eda(0x2bc),'tool':_0x225eda(0x22f)},{'pattern':/not a text file/,'error_type':_0x225eda(0x2a0),'tool':_0x225eda(0x22f)},{'pattern':/symbolic link/,'error_type':_0x225eda(0x2bc),'tool':_0x225eda(0x22f)},{'pattern':/Error reading file:/,'error_type':_0x225eda(0x1ec),'tool':_0x225eda(0x22f)},{'pattern':/status="error"/,'error_type':_0x225eda(0x209),'tool':_0x225eda(0x2cc)}];let _0x62aa8c=0x0;for(const _0x5e11ca of _0x4a2c4d){_0x5e11ca['role']===_0x225eda(0x29a)&&Array[_0x225eda(0x240)](_0x5e11ca[_0x225eda(0x246)])&&_0x62aa8c++;const _0x483e6f=_0x5e11ca[_0x225eda(0x2e5)];if((_0x5e11ca[_0x225eda(0x281)]===_0x225eda(0x230)||_0x5e11ca[_0x225eda(0x281)]===_0x225eda(0x2b6))&&_0x483e6f&&typeof _0x483e6f==='string')for(const {pattern:_0x38f77b,error_type:_0x15ac2a,tool:_0x394bdf}of _0x37d39a){const _0x536073=_0x483e6f[_0x225eda(0x290)](new RegExp(_0x38f77b[_0x225eda(0x2d4)],'g'));if(_0x536073)for(const _0x365ecd of _0x536073){const _0xe0cb5e=_0x483e6f[_0x225eda(0x1f0)](_0x365ecd),_0x21236d=_0x483e6f[_0x225eda(0x25d)](_0xe0cb5e,Math['min'](_0xe0cb5e+0xc8,_0x483e6f[_0x225eda(0x2e3)]));_0xbb72c0[_0x225eda(0x291)]({'tool':_0x394bdf,'error_type':_0x15ac2a,'error_message':_0x21236d['split']('\x0a')[0x0],'turn':_0x62aa8c});}}}return _0xbb72c0;};try{const _0x2df413=a0_0x5863e0[_0x5a09d5(0x23a)](_0xb4eafb['data'][_0x5a09d5(0x1fc)]),_0x2b0b70=_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x24c)],_0x5b4242=_0x2b0b70===_0x5a09d5(0x2a1)?{'allowNames':[_0x5a09d5(0x2a1)]}:undefined,_0x21f263=new LocalRipgrepProvider(_0x2df413,undefined,_0x5b4242);logger[_0x5a09d5(0x27b)](_0x5a09d5(0x2aa),_0x5a09d5(0x2a2),{'type':_0x5a09d5(0x250),'repo_root':_0x2df413,'search_type':_0x2b0b70||_0x5a09d5(0x2f0)}),logger[_0x5a09d5(0x27b)](_0x5a09d5(0x2aa),_0x5a09d5(0x252),{'query':_0xb4eafb['data'][_0x5a09d5(0x20d)],'repo_root':_0x2df413,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x1fdbbf=Date[_0x5a09d5(0x27f)](),_0x254569=await runWarpGrep({'searchTerm':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'repoRoot':_0x2df413,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x21f263,'search_type':_0x2b0b70}),_0x434115=Date[_0x5a09d5(0x27f)]()-_0x1fdbbf,_0x3bcbc3=_0x254569[_0x5a09d5(0x25c)]?.['metadata']?.[_0x5a09d5(0x2c0)]?.[_0x5a09d5(0x2e3)]??0x0;logger['debug'](_0x5a09d5(0x2aa),_0x5a09d5(0x1f7),{'termination':_0x254569[_0x5a09d5(0x1fe)],'turns':_0x254569[_0x5a09d5(0x242)]?.['turns']??0x0,'files_found':_0x3bcbc3,'latency_ms':_0x434115});const _0x262a62=_0x2f5026(_0x254569[_0x5a09d5(0x2d7)]);_0x262a62[_0x5a09d5(0x2e3)]>0x0&&reportMorphError({'error_message':_0x5a09d5(0x237)+_0x262a62[_0x5a09d5(0x2e3)]+_0x5a09d5(0x24a),'error_type':'SubToolError','level':_0x5a09d5(0x28d),'tool':_0x5a09d5(0x204),'context':{'repo_path':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)],'query':_0xb4eafb['data'][_0x5a09d5(0x20d)],'model':'morph-warp-grep-v2.1','termination_reason':_0x254569[_0x5a09d5(0x1fe)],'sub_tool_errors':_0x262a62,'timings':_0x254569['timings'],'tool_calls':_0x3ca5e0(_0x254569[_0x5a09d5(0x2d7)]),'messages':_0x254569[_0x5a09d5(0x2d7)]?.[_0x5a09d5(0x1bf)](_0x29d2b0=>({'role':_0x29d2b0['role'],'content':_0x29d2b0[_0x5a09d5(0x2e5)],..._0x29d2b0[_0x5a09d5(0x246)]?{'tool_calls':_0x29d2b0['tool_calls']['length']}:{},..._0x29d2b0[_0x5a09d5(0x249)]?{'tool_call_id':_0x29d2b0[_0x5a09d5(0x249)]}:{}}))},'source':_0x5a09d5(0x1f1)})[_0x5a09d5(0x26a)](()=>{});let _0x30c57e='';if(_0x254569[_0x5a09d5(0x1fe)]==='completed'&&_0x254569[_0x5a09d5(0x25c)]?.[_0x5a09d5(0x2cf)]?.['files']){const _0x352a61=_0x254569[_0x5a09d5(0x25c)][_0x5a09d5(0x2cf)]['files'];if(_0x352a61[_0x5a09d5(0x2e3)]===0x0)return _0x30c57e=_0x254569[_0x5a09d5(0x25c)][_0x5a09d5(0x2b0)]||_0x5a09d5(0x258),{'content':[{'type':'text','text':_0x30c57e}]};const _0x161af3=[],_0x414a4a=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x17c906 of _0x254569[_0x5a09d5(0x2d7)]){if(_0x17c906[_0x5a09d5(0x281)]===_0x5a09d5(0x29a)&&Array[_0x5a09d5(0x240)](_0x17c906[_0x5a09d5(0x246)]))for(const _0xdf2c6c of _0x17c906[_0x5a09d5(0x246)]){try{const _0x32466a=_0xdf2c6c['function']?.[_0x5a09d5(0x283)],_0x25eb61=JSON['parse'](_0xdf2c6c[_0x5a09d5(0x228)]?.[_0x5a09d5(0x256)]||'{}');if(_0x32466a===_0x5a09d5(0x1d5))_0x414a4a[_0x5a09d5(0x291)]('-\x20Grepped\x20\x27'+_0x25eb61['pattern']+_0x5a09d5(0x2ba)+(_0x25eb61[_0x5a09d5(0x1be)]||'.')+'`');else{if(_0x32466a===_0x5a09d5(0x22f))_0x414a4a['push'](_0x5a09d5(0x271)+_0x25eb61[_0x5a09d5(0x1be)]+'`');else{if(_0x32466a===_0x5a09d5(0x1c9))_0x414a4a[_0x5a09d5(0x291)](_0x5a09d5(0x238)+(_0x25eb61[_0x5a09d5(0x2b8)]||'.')+'`');else _0x32466a===_0x5a09d5(0x261)&&_0x414a4a['push']('-\x20Glob\x20search\x20`'+_0x25eb61[_0x5a09d5(0x25e)]+_0x5a09d5(0x227)+(_0x25eb61[_0x5a09d5(0x1be)]||'.')+'`');}}}catch{}}}_0x161af3[_0x5a09d5(0x291)](_0x414a4a[_0x5a09d5(0x21a)]('\x0a'));const _0x21d6c9=['','Relevant\x20context\x20found:'];for(const _0xbc11b6 of _0x352a61){if(_0xbc11b6[_0x5a09d5(0x219)]==='*')_0x21d6c9['push']('-\x20'+_0xbc11b6[_0x5a09d5(0x1be)]+':*');else{if(Array[_0x5a09d5(0x240)](_0xbc11b6[_0x5a09d5(0x219)])){const _0xb5d3ba=_0xbc11b6[_0x5a09d5(0x219)][_0x5a09d5(0x1bf)](([_0x29e1a9,_0x3a8063])=>{if(_0x29e1a9===_0x3a8063)return''+_0x29e1a9;return _0x29e1a9+'-'+_0x3a8063;});_0x21d6c9[_0x5a09d5(0x291)]('-\x20'+_0xbc11b6[_0x5a09d5(0x1be)]+':'+_0xb5d3ba['join'](','));}else _0x21d6c9[_0x5a09d5(0x291)]('-\x20'+_0xbc11b6[_0x5a09d5(0x1be)]+':*');}}_0x21d6c9[_0x5a09d5(0x291)](''),_0x161af3['push'](_0x21d6c9[_0x5a09d5(0x21a)]('\x0a')),_0x161af3[_0x5a09d5(0x291)](_0x5a09d5(0x2e1));const _0x5aadb7=[],_0x27a31e=[];for(const _0x2eb5c4 of _0x352a61){let _0x2bd801=a0_0x5863e0[_0x5a09d5(0x23a)](_0xb4eafb['data'][_0x5a09d5(0x1fc)],_0x2eb5c4[_0x5a09d5(0x1be)]),_0x30bb64=null,_0x282ba2=null;try{_0x30bb64=await a0_0x5f2eb7['readFile'](_0x2bd801,{'encoding':_0x5a09d5(0x29f)});}catch(_0x3e7a7e){const _0x2462f4=fixPathRepetition(_0x2bd801);if(_0x2462f4)try{_0x30bb64=await a0_0x5f2eb7['readFile'](_0x2462f4,{'encoding':'utf-8'}),_0x2bd801=_0x2462f4;}catch{_0x282ba2=_0x3e7a7e instanceof Error?_0x3e7a7e:new Error(String(_0x3e7a7e));}else _0x282ba2=_0x3e7a7e instanceof Error?_0x3e7a7e:new Error(String(_0x3e7a7e));}if(_0x30bb64!==null){const _0x52af40=_0x30bb64['split'](/\r?\n/),_0x57a0db=[];if(_0x2eb5c4[_0x5a09d5(0x219)]==='*'||!Array[_0x5a09d5(0x240)](_0x2eb5c4[_0x5a09d5(0x219)]))for(let _0xb8136a=0x1;_0xb8136a<=_0x52af40['length'];_0xb8136a++){const _0x1d4429=_0x52af40[_0xb8136a-0x1];_0x57a0db[_0x5a09d5(0x291)](_0xb8136a+'|\x20'+_0x1d4429);}else for(const [_0x3c849e,_0x5f127b]of _0x2eb5c4['lines']){_0x57a0db['length']>0x0&&_0x57a0db[_0x5a09d5(0x291)]('');for(let _0x165675=_0x3c849e;_0x165675<=_0x5f127b&&_0x165675<=_0x52af40['length'];_0x165675++){const _0x21e060=_0x52af40[_0x165675-0x1];_0x57a0db[_0x5a09d5(0x291)](_0x165675+'|\x20'+_0x21e060);}}_0x27a31e[_0x5a09d5(0x291)]({'path':_0x2eb5c4[_0x5a09d5(0x1be)],'content':_0x57a0db[_0x5a09d5(0x21a)]('\x0a')});}else _0x5aadb7[_0x5a09d5(0x291)]('<file\x20path=\x22'+_0x2eb5c4['path']+_0x5a09d5(0x1ff)+(_0x282ba2?.[_0x5a09d5(0x2ee)]||_0x5a09d5(0x1f5))+'\x0a</file>');}try{const _0x538b63=await compactFileContexts(_0x27a31e,_0xb4eafb[_0x5a09d5(0x280)]['search_string'],MORPH_API_KEY,MORPH_API_URL);for(const _0x5e1a10 of _0x538b63){_0x5aadb7[_0x5a09d5(0x291)](_0x5a09d5(0x1c2)+_0x5e1a10[_0x5a09d5(0x1be)]+'\x22>\x0a'+_0x5e1a10['content']+'\x0a</file>');}}catch(_0x5253d3){logger[_0x5a09d5(0x28d)]('MCP',_0x5a09d5(0x254),{'error':_0x5253d3 instanceof Error?_0x5253d3[_0x5a09d5(0x2ee)]:String(_0x5253d3),'files_count':_0x27a31e[_0x5a09d5(0x2e3)]});for(const _0x3ab485 of _0x27a31e){_0x5aadb7['push'](_0x5a09d5(0x1c2)+_0x3ab485[_0x5a09d5(0x1be)]+_0x5a09d5(0x205)+_0x3ab485[_0x5a09d5(0x2e5)]+_0x5a09d5(0x229));}}_0x161af3[_0x5a09d5(0x291)](_0x5aadb7[_0x5a09d5(0x21a)]('\x0a\x0a')),_0x30c57e=_0x161af3['join']('\x0a');const _0x47cf7b=_0x254569['errors']?.[_0x5a09d5(0x241)](_0x484add=>_0x484add['message']?.[_0x5a09d5(0x211)](_0x5a09d5(0x221)))||[];if(_0x47cf7b['length']>0x0){const _0x116889=_0x47cf7b[_0x5a09d5(0x1bf)](_0x21004d=>_0x21004d[_0x5a09d5(0x2ee)])[_0x5a09d5(0x21a)](';\x20');reportMorphError({'error_message':_0x116889,'error_type':_0x5a09d5(0x2c6),'context':{'tool':_0x5a09d5(0x204),'repo_path':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)],'query':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'model':_0x5a09d5(0x1dc),'termination_reason':_0x5a09d5(0x2c5),'error_count':_0x47cf7b[_0x5a09d5(0x2e3)],'is_timeout':![],'timings':_0x254569['timings'],'files_attempted':_0x352a61['map'](_0x41735f=>({'path':_0x41735f[_0x5a09d5(0x1be)],'lines':_0x41735f[_0x5a09d5(0x219)]})),'tool_calls':_0x3ca5e0(_0x254569[_0x5a09d5(0x2d7)]),'messages':_0x254569[_0x5a09d5(0x2d7)]?.[_0x5a09d5(0x1bf)](_0x4ee140=>({'role':_0x4ee140[_0x5a09d5(0x281)],'content':_0x4ee140[_0x5a09d5(0x2e5)],..._0x4ee140[_0x5a09d5(0x246)]?{'tool_calls':_0x4ee140[_0x5a09d5(0x246)]['length']}:{},..._0x4ee140[_0x5a09d5(0x249)]?{'tool_call_id':_0x4ee140[_0x5a09d5(0x249)]}:{}})),'request_content':{'query':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'repo_path':_0xb4eafb['data']['repo_path'],'repoRoot':a0_0x5863e0[_0x5a09d5(0x23a)](_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)]),'model':'morph-warp-grep-v2.1'}},'source':_0x5a09d5(0x1f1)})[_0x5a09d5(0x26a)](()=>{});}}else{if(_0x254569[_0x5a09d5(0x1fe)]===_0x5a09d5(0x29e)&&_0x254569[_0x5a09d5(0x288)]['length']>0x0){const _0x437274=_0x254569[_0x5a09d5(0x288)]['map'](_0x4d9ecd=>_0x4d9ecd[_0x5a09d5(0x2ee)])[_0x5a09d5(0x21a)](';\x20');_0x30c57e=_0x5a09d5(0x2b7)+_0x437274;const _0x4bdf0a=_0x437274[_0x5a09d5(0x1e5)]()[_0x5a09d5(0x1c6)](_0x5a09d5(0x1d8))||_0x437274['toLowerCase']()['includes'](_0x5a09d5(0x1e1))||_0x437274['toLowerCase']()[_0x5a09d5(0x1c6)]('etimedout'),_0xa7aa=_0x254569[_0x5a09d5(0x25c)]?.[_0x5a09d5(0x2cf)]?.[_0x5a09d5(0x2c0)],_0x55b5b6=_0x254569[_0x5a09d5(0x288)][0x0];reportMorphError({'error_message':_0x437274,'error_type':_0x4bdf0a?_0x5a09d5(0x235):_0x55b5b6?.['constructor']?.['name']||_0x5a09d5(0x200),'context':{'tool':_0x5a09d5(0x204),'repo_path':_0xb4eafb[_0x5a09d5(0x280)]['repo_path'],'query':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'model':_0x5a09d5(0x1dc),'termination_reason':_0x254569[_0x5a09d5(0x1fe)],'error_count':_0x254569[_0x5a09d5(0x288)][_0x5a09d5(0x2e3)],'is_timeout':_0x4bdf0a,'timings':_0x254569[_0x5a09d5(0x242)],'files_attempted':_0xa7aa?.[_0x5a09d5(0x1bf)](_0x4c51a3=>({'path':_0x4c51a3[_0x5a09d5(0x1be)],'lines':_0x4c51a3[_0x5a09d5(0x219)]})),'tool_calls':_0x3ca5e0(_0x254569[_0x5a09d5(0x2d7)]),'messages':_0x254569[_0x5a09d5(0x2d7)]?.[_0x5a09d5(0x1bf)](_0x1c96b9=>({'role':_0x1c96b9[_0x5a09d5(0x281)],'content':_0x1c96b9[_0x5a09d5(0x2e5)],..._0x1c96b9[_0x5a09d5(0x246)]?{'tool_calls':_0x1c96b9[_0x5a09d5(0x246)][_0x5a09d5(0x2e3)]}:{},..._0x1c96b9['tool_call_id']?{'tool_call_id':_0x1c96b9[_0x5a09d5(0x249)]}:{}})),'request_content':{'query':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'repo_path':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)],'repoRoot':a0_0x5863e0['resolve'](_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x55b5b6?.[_0x5a09d5(0x28c)]||undefined,'source':_0x5a09d5(0x1f1)})[_0x5a09d5(0x26a)](()=>{});}else _0x30c57e=_0x5a09d5(0x217);}return{'content':[{'type':_0x5a09d5(0x278),'text':_0x30c57e}]};}catch(_0x16f623){const _0x171979=handleMorphAPIError(_0x16f623);if(_0x171979)return logger['error'](_0x5a09d5(0x2aa),_0x5a09d5(0x2c8),{'tool':_0x5a09d5(0x204),'error':_0x5a09d5(0x266),'latency_ms':Date[_0x5a09d5(0x27f)]()-_0x175270}),_0x171979;const _0xd8bc5f=_0x16f623 instanceof Error?_0x16f623[_0x5a09d5(0x2ee)]:String(_0x16f623);logger[_0x5a09d5(0x2ef)](_0x5a09d5(0x2aa),_0x5a09d5(0x2c8),{'tool':_0x5a09d5(0x204),'error':_0xd8bc5f,'repo_path':_0xb4eafb[_0x5a09d5(0x280)]['repo_path'],'query':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'latency_ms':Date['now']()-_0x175270});const _0x70a54e=_0xd8bc5f['toLowerCase']()[_0x5a09d5(0x1c6)](_0x5a09d5(0x1d8))||_0xd8bc5f[_0x5a09d5(0x1e5)]()[_0x5a09d5(0x1c6)](_0x5a09d5(0x1e1))||_0xd8bc5f[_0x5a09d5(0x1e5)]()['includes'](_0x5a09d5(0x2e0))||_0x16f623 instanceof Error&&_0x16f623['name']===_0x5a09d5(0x235);return reportMorphError({'error_message':_0xd8bc5f,'error_type':_0x70a54e?_0x5a09d5(0x235):_0x16f623 instanceof Error?_0x16f623['constructor'][_0x5a09d5(0x283)]:_0x5a09d5(0x1c3),'context':{'tool':_0x5a09d5(0x204),'repo_path':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)],'query':_0xb4eafb[_0x5a09d5(0x280)]['search_string'],'model':'morph-warp-grep-v2.1','is_timeout':_0x70a54e,'exception_phase':_0x5a09d5(0x2d1),'request_content':{'query':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'repo_path':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)],'repoRoot':a0_0x5863e0[_0x5a09d5(0x23a)](_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)]),'model':_0x5a09d5(0x1dc)}},'stack_trace':_0x16f623 instanceof Error?_0x16f623[_0x5a09d5(0x28c)]:undefined,'source':_0x5a09d5(0x1f1)})[_0x5a09d5(0x26a)](()=>{}),{'content':[{'type':_0x5a09d5(0x278),'text':_0x5a09d5(0x2eb)+_0xd8bc5f}],'isError':![]};}}case TOOL_NAMES[_0x5a09d5(0x226)]:{const _0x5852f0=WarpGrepGitHubArgsSchema[_0x5a09d5(0x24b)](_0x363cd2);if(!_0x5852f0[_0x5a09d5(0x265)])return{'content':[{'type':_0x5a09d5(0x278),'text':_0x5a09d5(0x27a)+_0x5852f0[_0x5a09d5(0x2ef)]}],'isError':!![]};const _0x30aab2=_0x5852f0[_0x5a09d5(0x280)][_0x5a09d5(0x1e9)]||_0x5852f0[_0x5a09d5(0x280)][_0x5a09d5(0x20f)];if(!_0x30aab2)return{'content':[{'type':'text','text':_0x5a09d5(0x21d)}],'isError':!![]};const _0x2c45a3=MORPH_API_KEY;if(!_0x2c45a3)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x29af95=Date[_0x5a09d5(0x27f)]();logger[_0x5a09d5(0x27b)]('MCP',_0x5a09d5(0x1e3),{'identifier':_0x30aab2,'query':_0x5852f0[_0x5a09d5(0x280)]['search_string'],'branch':_0x5852f0[_0x5a09d5(0x280)][_0x5a09d5(0x2af)]});try{const _0x47d8ac=new WarpGrepClient({'morphApiKey':_0x2c45a3,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x504d98=await _0x47d8ac['searchGitHub']({'searchTerm':_0x5852f0[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'github':_0x30aab2,'branch':_0x5852f0[_0x5a09d5(0x280)]['branch']}),_0x1f4abe=Date[_0x5a09d5(0x27f)]()-_0x29af95;logMcpStderr(_0x5a09d5(0x2b3)+_0x1f4abe+_0x5a09d5(0x1de)+_0x504d98[_0x5a09d5(0x265)]);const _0x488ff4=formatResult(_0x504d98);return{'content':[{'type':_0x5a09d5(0x278),'text':_0x488ff4}]};}catch(_0x27d32b){const _0x552beb=handleMorphAPIError(_0x27d32b);if(_0x552beb)return _0x552beb;const _0x182f51=Date[_0x5a09d5(0x27f)]()-_0x29af95,_0x123b2a=_0x27d32b instanceof Error?_0x27d32b[_0x5a09d5(0x2ee)]:String(_0x27d32b);return logMcpStderr(_0x5a09d5(0x1e0)+_0x182f51+_0x5a09d5(0x1d1),_0x123b2a),reportMorphError({'error_message':_0x123b2a,'error_type':_0x27d32b instanceof Error?_0x27d32b[_0x5a09d5(0x247)][_0x5a09d5(0x283)]:_0x5a09d5(0x1c3),'context':{'tool':'github_codebase_search','github_url':_0x30aab2,'search_string':_0x5852f0[_0x5a09d5(0x280)]['search_string'],'branch':_0x5852f0[_0x5a09d5(0x280)]['branch']},'stack_trace':_0x27d32b instanceof Error?_0x27d32b[_0x5a09d5(0x28c)]:undefined,'source':_0x5a09d5(0x1f1),'tool':_0x5a09d5(0x296),'latency_ms':_0x182f51})[_0x5a09d5(0x26a)](()=>{}),{'content':[{'type':'text','text':_0x5a09d5(0x28f)+_0x123b2a}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x5f498c);}}catch(_0x2cebef){const _0x4382fe=_0x2cebef instanceof Error?_0x2cebef[_0x5a09d5(0x2ee)]:String(_0x2cebef);return reportMorphError({'error_message':_0x4382fe,'error_type':_0x2cebef instanceof Error?_0x2cebef[_0x5a09d5(0x247)][_0x5a09d5(0x283)]:_0x5a09d5(0x1c3),'context':{'tool':_0x5f498c,'arguments':_0x363cd2?JSON[_0x5a09d5(0x2bf)](_0x363cd2)[_0x5a09d5(0x25d)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x2cebef instanceof Error?_0x2cebef[_0x5a09d5(0x28c)]:undefined,'source':_0x5a09d5(0x1f1)})[_0x5a09d5(0x26a)](()=>{}),{'content':[{'type':_0x5a09d5(0x278),'text':_0x5a09d5(0x2b7)+_0x4382fe}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x3f0cea){const _0x90adeb=a0_0x41e81a,_0x417ddc=await getValidRootDirectories(_0x3f0cea);if(_0x417ddc['length']>0x0)allowedDirectories=[..._0x417ddc],logMcpStderr(_0x90adeb(0x1f2)+_0x417ddc[_0x90adeb(0x2e3)]+'\x20valid\x20directories');else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x3858ba=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x3858ba&&(allowedDirectories=[_0x3858ba],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x3858ba));}catch(_0x59da5d){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x59da5d);}}}server[a0_0x41e81a(0x2c9)](RootsListChangedNotificationSchema,async()=>{const _0x3b33e5=a0_0x41e81a;try{const _0x497614=await server[_0x3b33e5(0x289)]();_0x497614&&_0x3b33e5(0x2ae)in _0x497614&&await updateAllowedDirectoriesFromRoots(_0x497614['roots']);}catch(_0x17fead){logMcpStderr(_0x3b33e5(0x2e6),_0x17fead instanceof Error?_0x17fead[_0x3b33e5(0x2ee)]:String(_0x17fead));}}),server[a0_0x41e81a(0x1dd)]=async()=>{const _0x154f30=a0_0x41e81a,_0x5f06d7=server[_0x154f30(0x22a)]();if(_0x5f06d7?.[_0x154f30(0x2ae)])try{const _0x3b5790=await server[_0x154f30(0x289)]();_0x3b5790&&'roots'in _0x3b5790?await updateAllowedDirectoriesFromRoots(_0x3b5790[_0x154f30(0x2ae)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x2869b2){logMcpStderr('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x2869b2 instanceof Error?_0x2869b2['message']:String(_0x2869b2));}else{if(allowedDirectories[_0x154f30(0x2e3)]>0x0)logMcpStderr(_0x154f30(0x295),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x154f30(0x1cd));else throw new Error(_0x154f30(0x1cf));}}};async function runServer(){const _0x23ad5a=a0_0x41e81a,_0x61670a=new StdioServerTransport();await server[_0x23ad5a(0x1d9)](_0x61670a),logMcpStderr('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories['length']===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x41e81a(0x26a)](_0x2863d5=>{const _0x1074cd=a0_0x41e81a;logMcpStderr(_0x1074cd(0x2ac),_0x2863d5),process[_0x1074cd(0x1ed)](0x1);});
|
|
2
|
+
const a0_0x231f6c=a0_0x2218;(function(_0x101d3d,_0x14fc74){const _0x4947c8=a0_0x2218,_0x36b4bd=_0x101d3d();while(!![]){try{const _0x12a916=parseInt(_0x4947c8(0x1e2))/0x1+parseInt(_0x4947c8(0x293))/0x2*(parseInt(_0x4947c8(0x29b))/0x3)+-parseInt(_0x4947c8(0x1ac))/0x4+parseInt(_0x4947c8(0x1b9))/0x5+parseInt(_0x4947c8(0x1a2))/0x6*(-parseInt(_0x4947c8(0x262))/0x7)+parseInt(_0x4947c8(0x219))/0x8*(parseInt(_0x4947c8(0x2b2))/0x9)+-parseInt(_0x4947c8(0x27b))/0xa;if(_0x12a916===_0x14fc74)break;else _0x36b4bd['push'](_0x36b4bd['shift']());}catch(_0x1c4159){_0x36b4bd['push'](_0x36b4bd['shift']());}}}(a0_0x57ec,0x6520d));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_0x3ed385 from'fs/promises';import a0_0x146359 from'path';import a0_0x1d7b4c 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';function a0_0x2218(_0x508a99,_0x50fef7){_0x508a99=_0x508a99-0x194;const _0x57ec87=a0_0x57ec();let _0x22189a=_0x57ec87[_0x508a99];return _0x22189a;}function a0_0x57ec(){const _0x2de968=['\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','listRoots','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','split','dryRun','terminated','\x22>\x0aError\x20reading\x20file:\x20','code','normalize','assistant','github_url','lines','trim','toLowerCase','setRequestHandler','warp_grep_start','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','warp_grep_complete','user','optional','context','sep','mcp-filesystem','slice','cwd','indexOf','Tool\x20\x22','role','argv','[github_codebase_search]\x20Done\x20in\x20','Created\x20File','some','floor','code_edit','errors','MORPH_LARGE_APPLY','metadata','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','grep_search','setNotificationHandler','WORKSPACE_ROOT','❌\x20Morph\x20Edit\x20Failed:\x20','min','map','SubToolError','filter','completionId','\x20error(s)','target_filepath','.\x20Path:\x20','error','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.','version','provider_created','Workspace\x20mode\x20enabled:\x20Using\x20','size','github_codebase_search','morph-','1001GRtAAG','enum','morph-warp-grep-v2.1','name','Applied','grep\x20\x27','env','MORPH_WARP_GREP_TIMEOUT','pattern','Unknown\x20error','.git','--api-key','tsconfig.json','boolean','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','linesAdded','roots','includes','repo_path','file_read_complete','\x20disabled\x20via\x20DISABLED_TOOLS','@morphllm/morphmcp\x20','Morph\x20Edit\x20Preview','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','unknown','202270eREpru','`\x20in\x20`','exit','timeout','grep','homedir','getClientCapabilities','Cargo.toml','new_string','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a',',\x20modified\x20','text','-\x20Listed\x20directory\x20`','MCP','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','Fallback:\x20Using\x20workspace\x20root\x20','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','stringify','Warning:\x20','A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20','../package.json','tool_call_received','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','package.json','16918mJiwor','turns','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','Failed\x20to\x20request\x20roots\x20from\x20client:','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','path_validation_failed','access','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','54tuttOm','false','ENOENT','file','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','Rules:\x0a','linesModified','\x20-\x20','search_string','read','glob\x20\x27','tool_call_error','<file\x20path=\x22','CODEBASE_SEARCH','completed_with_file_errors','function','DISABLED_TOOLS','timed\x20out','\x20as\x20allowed\x20directory','basename','morph-v3-large','-\x20Grepped\x20\x27','.\x20Changes:\x20','2462931KAaXFJ','catch','default','RipgrepNotAvailable','source','\x20(new\x20file)','instruction','0.2.0','data','Morph\x20FastApply\x20failed\x20without\x20error\x20message','API\x20error\x20(auth/rate-limit)','now','GitHub\x20search\x20failed:\x20','TimeoutError','substring','Unknown\x20tool:\x20','object','morph-mcp','content','readFile','list_directory','owner_repo','instructions','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','-\x20Preserve\x20exact\x20indentation\x0a','params','pyproject.toml','glob','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','etimedout','describe','Error:\x20','description','15432ZMUNfn','MORPH_API_KEY','path_validation_resolved','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','match','node_modules','\x20\x20morph-mcp','WarpGrepError','path','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','2989108xvzCUG','completed','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','parse','EDIT_FILE','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','.cursor','message','warn','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','-\x20Glob\x20search\x20`','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','4037350ryKZuF','success','linesRemoved','\x20chars)','join','tool_calls','files','Repository\x20identifier','all','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','BinaryFile','tool_call_id','status','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','\x22.\x20Known\x20tools:\x20','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','\x0aOptions:','push','dirname','edit','string','application/json','File\x20read\x20error:','Max\x20results\x20to\x20return','Morph\x20Edit\x20','Bearer\x20','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','timings','runWarpGrep_call','oninitialized','post','Disabled\x20tools:\x20','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Error\x20accessing\x20directory\x20','arguments','ENABLE_WORKSPACE_MODE','debug','Fatal\x20error\x20running\x20server:','constructor','42471oNhDbA','target_file','codebase_search','Specific\x20commit\x20hash\x20to\x20search','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','MORPH_API_URL','resolve','\x0aExamples:','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','branch','searchGitHub','edit_file','\x20valid\x20directories','search_type','terminationReason','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','startsWith','has',',\x20removed\x20','Preview\x20changes\x20without\x20applying\x20them.','compaction_failed','go.mod','LocalRipgrepProvider','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','github_search_start','utf-8','messages','command','\x22>\x0a','safeParse','--api-key=','Relevant\x20context\x20found:','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','log','Parent\x20directory\x20does\x20not\x20exist:\x20','Tool\x20','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','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.','file_path','composer.json','realpath','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','-\x20Read\x20file\x20`','stack','PWD','Invalid\x20arguments:\x20','isArray','sk-','UnknownError','every','finish','list_directory\x20','length','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','16LNujRe','unknown\x20error','filePath','GITHUB_CODEBASE_SEARCH','morph-v3-fast','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','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.','[could\x20not\x20read\x20file:\x20','\x0a</file>','changes','FileReadError','Warning:\x20Workspace\x20fallback\x20failed:\x20','requiresApiKey','ms:'];a0_0x57ec=function(){return _0x2de968;};return a0_0x57ec();}import a0_0x2590e9 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x40c9d3){const _0x8f9f7e=a0_0x2218,_0x324a98=_0x40c9d3[_0x8f9f7e(0x22b)](a0_0x146359[_0x8f9f7e(0x23d)])[_0x8f9f7e(0x255)](Boolean);if(_0x324a98['length']<0x2)return null;for(let _0x156ce8=Math[_0x8f9f7e(0x248)](_0x324a98['length']/0x2);_0x156ce8>=0x1;_0x156ce8--){for(let _0x50a1e0=0x0;_0x50a1e0<=_0x324a98['length']-0x2*_0x156ce8;_0x50a1e0++){const _0x5894c4=_0x324a98[_0x8f9f7e(0x23f)](_0x50a1e0,_0x50a1e0+_0x156ce8),_0x18b795=_0x324a98[_0x8f9f7e(0x23f)](_0x50a1e0+_0x156ce8,_0x50a1e0+0x2*_0x156ce8);if(_0x5894c4[_0x8f9f7e(0x214)]((_0x513950,_0x2bcf53)=>_0x513950===_0x18b795[_0x2bcf53])){const _0x4ad43f=[..._0x324a98['slice'](0x0,_0x50a1e0),..._0x324a98[_0x8f9f7e(0x23f)](_0x50a1e0+_0x156ce8)];return a0_0x146359[_0x8f9f7e(0x23d)]+_0x4ad43f['join'](a0_0x146359[_0x8f9f7e(0x23d)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x6d2e5b=a0_0x2218;try{const _0x56d369=require(_0x6d2e5b(0x28f));return _0x56d369[_0x6d2e5b(0x25c)]??'unknown';}catch(_0x2865d2){return logMcpStderr(_0x6d2e5b(0x1c2),_0x2865d2),_0x6d2e5b(0x27a);}}function printHelp(){const _0x5b9b33=a0_0x2218;console['log'](_0x5b9b33(0x277)+getPackageVersion()),console[_0x5b9b33(0x203)](_0x5b9b33(0x21e)),console['log'](_0x5b9b33(0x1cb)),console[_0x5b9b33(0x203)](_0x5b9b33(0x1f1)),console[_0x5b9b33(0x203)](_0x5b9b33(0x228)),console[_0x5b9b33(0x203)](_0x5b9b33(0x21f)),console[_0x5b9b33(0x203)](_0x5b9b33(0x1e9)),console[_0x5b9b33(0x203)](_0x5b9b33(0x1a8)),console['log'](_0x5b9b33(0x1c9));}const cliArgs=process[a0_0x231f6c(0x244)][a0_0x231f6c(0x23f)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs[a0_0x231f6c(0x247)](_0x1a307f=>VERSION_FLAGS[a0_0x231f6c(0x1f3)](_0x1a307f))&&(console[a0_0x231f6c(0x203)]('@morphllm/morphmcp\x20'+getPackageVersion()),process['exit'](0x0));cliArgs['some'](_0x19915b=>HELP_FLAGS['has'](_0x19915b))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x421452){const _0x23fb11=a0_0x231f6c;for(let _0x3706c6=0x0;_0x3706c6<cliArgs[_0x23fb11(0x217)];_0x3706c6++){const _0x2f478d=cliArgs[_0x3706c6];if(_0x2f478d[_0x23fb11(0x1f2)]('--'+_0x421452+'='))return _0x2f478d['slice'](('--'+_0x421452+'=')[_0x23fb11(0x217)]);if(_0x2f478d==='--'+_0x421452&&_0x3706c6+0x1<cliArgs[_0x23fb11(0x217)])return cliArgs[_0x3706c6+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x231f6c(0x1f3)](arg)||HELP_FLAGS[a0_0x231f6c(0x1f3)](arg))continue;if(arg[a0_0x231f6c(0x1f2)](a0_0x231f6c(0x200)))continue;if(arg===a0_0x231f6c(0x26d)){i++;continue;}args[a0_0x231f6c(0x1cc)](arg);}const WORKSPACE_ROOT=process[a0_0x231f6c(0x268)][a0_0x231f6c(0x250)]||process['env'][a0_0x231f6c(0x20f)]||process[a0_0x231f6c(0x240)](),ENABLE_WORKSPACE_MODE=process[a0_0x231f6c(0x268)][a0_0x231f6c(0x1de)]!==a0_0x231f6c(0x29c),MORPH_API_KEY=getCliArg('api-key')??process[a0_0x231f6c(0x268)][a0_0x231f6c(0x1a3)],MORPH_API_URL=process['env'][a0_0x231f6c(0x1e7)],MORPH_LARGE_APPLY=process['env'][a0_0x231f6c(0x24b)]!==a0_0x231f6c(0x29c),MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x231f6c(0x269)]?parseInt(process[a0_0x231f6c(0x268)][a0_0x231f6c(0x269)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x231f6c(0x268)]['DISABLED_TOOLS']?new Set(process[a0_0x231f6c(0x268)][a0_0x231f6c(0x2ab)][a0_0x231f6c(0x22b)](',')[a0_0x231f6c(0x253)](_0x288027=>_0x288027[a0_0x231f6c(0x234)]())['filter'](_0x58a5d2=>_0x58a5d2[a0_0x231f6c(0x217)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x231f6c(0x25f)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x231f6c(0x1f3)](tool)&&console[a0_0x231f6c(0x25a)](a0_0x231f6c(0x198)+tool+a0_0x231f6c(0x1c8)+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console['error'](a0_0x231f6c(0x1da)+[...DISABLED_TOOLS][a0_0x231f6c(0x1bd)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith']('sk-')&&!MORPH_API_KEY['startsWith'](a0_0x231f6c(0x261))&&logMcpStderr(a0_0x231f6c(0x1b1));async function reportMorphError(_0xe94246){const _0x4c2e75=a0_0x231f6c;try{await a0_0x2590e9[_0x4c2e75(0x1d9)]('https://morphllm.com/api/error-report',{..._0xe94246,'timestamp':new Date()['toISOString'](),'source':_0xe94246['source']||_0x4c2e75(0x23e),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0xe94246[_0x4c2e75(0x23c)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x4c2e75(0x1d0),'Authorization':_0x4c2e75(0x1d4)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x49cea8,_0x38b268){const _0xd589c=a0_0x231f6c;if(_0x49cea8&&typeof _0x49cea8===_0xd589c(0x2c2)&&_0xd589c(0x1c5)in _0x49cea8)return _0x49cea8['status'];if(_0x49cea8&&typeof _0x49cea8===_0xd589c(0x2c2)&&'response'in _0x49cea8)return _0x49cea8['response']?.[_0xd589c(0x1c5)];const _0x35be96=_0x38b268[_0xd589c(0x1a6)](/\b(401|429)\b/);return _0x35be96?parseInt(_0x35be96[0x1],0xa):null;}function handleMorphAPIError(_0xcd63a8){const _0x38f9cf=a0_0x231f6c,_0x190a72=_0xcd63a8 instanceof Error?_0xcd63a8[_0x38f9cf(0x1b3)]:String(_0xcd63a8),_0x2ba529=extractStatusCode(_0xcd63a8,_0x190a72);switch(_0x2ba529){case 0x191:return{'content':[{'type':_0x38f9cf(0x286),'text':_0x38f9cf(0x220)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x38f9cf(0x286),'text':_0x38f9cf(0x202)}],'isError':!![]};default:return null;}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x231f6c(0x20c)),logMcpStderr(a0_0x231f6c(0x1c7)),logMcpStderr(a0_0x231f6c(0x238)),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x231f6c(0x1ab)),logMcpStderr(a0_0x231f6c(0x207)));function normalizePath(_0x5c28b1){const _0x39d877=a0_0x231f6c;return a0_0x146359[_0x39d877(0x230)](_0x5c28b1);}function expandHome(_0x3977ee){const _0x1bc4ed=a0_0x231f6c;if(_0x3977ee[_0x1bc4ed(0x1f2)]('~/')||_0x3977ee==='~')return a0_0x146359['join'](a0_0x1d7b4c[_0x1bc4ed(0x280)](),_0x3977ee[_0x1bc4ed(0x23f)](0x1));return _0x3977ee;}let allowedDirectories=await Promise[a0_0x231f6c(0x1c1)](args['map'](async _0x11b605=>{const _0x18c26f=a0_0x231f6c,_0x418256=expandHome(_0x11b605),_0x224b5b=a0_0x146359[_0x18c26f(0x1e8)](_0x418256);try{const _0x27bc6c=await a0_0x3ed385[_0x18c26f(0x20b)](_0x224b5b);return normalizePath(_0x27bc6c);}catch(_0x48495f){return normalizePath(_0x224b5b);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x231f6c(0x217)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x231f6c(0x1cc)](workspaceDir),logMcpStderr(a0_0x231f6c(0x25e)+workspaceDir+a0_0x231f6c(0x2ad)));}catch(a0_0x10bc0e){logMcpStderr(a0_0x231f6c(0x19d)+a0_0x10bc0e);}async function detectWorkspaceRoot(_0x44068c){const _0x4aed0=a0_0x231f6c;let _0x51fed3=a0_0x146359[_0x4aed0(0x1e8)](_0x44068c);const _0x502396=[_0x4aed0(0x26c),'.vscode',_0x4aed0(0x292),_0x4aed0(0x282),_0x4aed0(0x19b),_0x4aed0(0x1f7),_0x4aed0(0x1b2),_0x4aed0(0x26e),_0x4aed0(0x20a)];while(_0x51fed3!==a0_0x146359[_0x4aed0(0x1cd)](_0x51fed3)){for(const _0x3780d1 of _0x502396){const _0x1ec5b1=a0_0x146359['join'](_0x51fed3,_0x3780d1);try{return await a0_0x3ed385[_0x4aed0(0x299)](_0x1ec5b1),normalizePath(_0x51fed3);}catch{}}_0x51fed3=a0_0x146359[_0x4aed0(0x1cd)](_0x51fed3);}return normalizePath(_0x44068c);}await Promise[a0_0x231f6c(0x1c1)](args['map'](async _0xa03992=>{const _0x50d8f7=a0_0x231f6c;try{const _0xf89f8a=await a0_0x3ed385['stat'](expandHome(_0xa03992));!_0xf89f8a['isDirectory']()&&(logMcpStderr(_0x50d8f7(0x1a0)+_0xa03992+'\x20is\x20not\x20a\x20directory'),process[_0x50d8f7(0x27d)](0x1));}catch(_0x40959f){logMcpStderr(_0x50d8f7(0x1dc)+_0xa03992+':',_0x40959f),process['exit'](0x1);}}));async function validatePath(_0x4cbf84){const _0x27c2ed=a0_0x231f6c,_0x56c840=expandHome(_0x4cbf84),_0x510c56=a0_0x146359[_0x27c2ed(0x1e8)](_0x56c840);logger[_0x27c2ed(0x1df)]('MCP','path_validation_start',{'raw_path':_0x4cbf84,'absolute':_0x510c56});try{const _0x14591d=await a0_0x3ed385['realpath'](_0x510c56);return logger[_0x27c2ed(0x1df)]('MCP',_0x27c2ed(0x1a4),{'resolved':_0x14591d,'symlink':_0x14591d!==_0x510c56}),_0x14591d;}catch(_0x3587a4){if(_0x3587a4[_0x27c2ed(0x22f)]===_0x27c2ed(0x29d)){const _0x1718a2=a0_0x146359['dirname'](_0x510c56);try{const _0x4c39c8=await a0_0x3ed385[_0x27c2ed(0x20b)](_0x1718a2),_0x108cff=a0_0x146359[_0x27c2ed(0x1bd)](_0x4c39c8,a0_0x146359[_0x27c2ed(0x2ae)](_0x510c56));return logger[_0x27c2ed(0x1df)](_0x27c2ed(0x288),'path_validation_resolved',{'resolved':_0x108cff,'new_file':!![]}),_0x108cff;}catch{logger[_0x27c2ed(0x25a)]('MCP',_0x27c2ed(0x298),{'raw_path':_0x4cbf84,'error':_0x27c2ed(0x204)+_0x1718a2});throw new Error(_0x27c2ed(0x204)+_0x1718a2);}}logger[_0x27c2ed(0x25a)](_0x27c2ed(0x288),_0x27c2ed(0x298),{'raw_path':_0x4cbf84,'error':_0x3587a4['message']});throw _0x3587a4;}}const MorphEditFileArgsSchema=z[a0_0x231f6c(0x2c2)]({'path':z[a0_0x231f6c(0x1cf)](),'code_edit':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x270)),'instruction':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1b8)),'dryRun':z[a0_0x231f6c(0x26f)]()['default'](![])[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1f5))}),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_0x231f6c(0x2c2)]({'search_string':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)]('The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos'),'search_type':z[a0_0x231f6c(0x263)]([a0_0x231f6c(0x2b4),'node_modules'])[a0_0x231f6c(0x23b)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1c6))}),WarpGrepGitHubArgsSchema=z[a0_0x231f6c(0x2c2)]({'search_string':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()['optional']()['describe'](a0_0x231f6c(0x25b)),'owner_repo':z['string']()[a0_0x231f6c(0x23b)]()['describe'](a0_0x231f6c(0x1ae)),'branch':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x23b)]()['describe'](a0_0x231f6c(0x1db))}),CodebaseSearchArgsSchema=z[a0_0x231f6c(0x2c2)]({'query':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1c0)),'branch':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x23b)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x297)),'commitHash':z['string']()[a0_0x231f6c(0x23b)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1e5)),'targetDirectories':z['array'](z[a0_0x231f6c(0x1cf)]())[a0_0x231f6c(0x2b4)]([])['describe']('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z['number']()[a0_0x231f6c(0x23b)]()['default'](0xa)[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1d2))}),server=new Server({'name':a0_0x231f6c(0x2c3),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x231f6c(0x236)](ListToolsRequestSchema,async()=>{const _0x362509=a0_0x231f6c,_0x36731e=[{'name':TOOL_NAMES[_0x362509(0x1b0)],'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'+'Parameters:\x0a'+_0x362509(0x206)+'-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a'+'-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a'+_0x362509(0x1f9)+'Example\x20format:\x0a'+_0x362509(0x284)+_0x362509(0x2a0)+_0x362509(0x1b5)+_0x362509(0x199)+_0x362509(0x295)+_0x362509(0x279),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x362509(0x2a8)],'description':_0x362509(0x28e)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x362509(0x22a)+_0x362509(0x1b6)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x11ddf5=_0x36731e[_0x362509(0x255)](_0x2e0805=>{const _0x1df734=_0x362509;if(DISABLED_TOOLS[_0x1df734(0x1f3)](_0x2e0805[_0x1df734(0x265)]))return console[_0x1df734(0x25a)](_0x1df734(0x205)+_0x2e0805[_0x1df734(0x265)]+_0x1df734(0x276)),![];if(_0x1df734(0x226)in _0x2e0805&&_0x2e0805[_0x1df734(0x226)]&&!MORPH_API_KEY)return logMcpStderr(_0x1df734(0x28d)+_0x2e0805[_0x1df734(0x265)]+_0x1df734(0x29f)),![];return!![];});return{'tools':_0x11ddf5[_0x362509(0x253)](_0xac4d80=>({'name':_0xac4d80[_0x362509(0x265)],'description':_0xac4d80[_0x362509(0x1a1)],'inputSchema':_0xac4d80['inputSchema']}))};}),server[a0_0x231f6c(0x236)](CallToolRequestSchema,async _0x986cf2=>{const _0x5e3def=a0_0x231f6c,{name:_0x150814,arguments:_0x17d255}=_0x986cf2[_0x5e3def(0x19a)],_0x4722eb=Date[_0x5e3def(0x2bd)]();logger[_0x5e3def(0x1df)](_0x5e3def(0x288),_0x5e3def(0x290),{'tool':_0x150814,'args':_0x150814===_0x5e3def(0x1ed)?{'path':_0x17d255?.['path'],'instruction':_0x17d255?.[_0x5e3def(0x2b8)]||_0x17d255?.[_0x5e3def(0x197)],'dryRun':_0x17d255?.[_0x5e3def(0x22c)]}:_0x17d255});try{if(!MORPH_API_KEY)return{'content':[{'type':'text','text':_0x5e3def(0x24d)}],'isError':!![]};if(!MORPH_API_KEY[_0x5e3def(0x1f2)](_0x5e3def(0x212))&&!MORPH_API_KEY[_0x5e3def(0x1f2)](_0x5e3def(0x261)))return{'content':[{'type':_0x5e3def(0x286),'text':'Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.'}],'isError':!![]};if(DISABLED_TOOLS[_0x5e3def(0x1f3)](_0x150814))return{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x242)+_0x150814+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x150814){case TOOL_NAMES[_0x5e3def(0x1b0)]:{let _0x56b691=_0x17d255;if(_0x56b691&&typeof _0x56b691===_0x5e3def(0x2c2)){if(!(_0x5e3def(0x1aa)in _0x56b691)){const _0x347eba=_0x56b691[_0x5e3def(0x1e3)]??_0x56b691[_0x5e3def(0x21b)]??_0x56b691[_0x5e3def(0x258)]??_0x56b691[_0x5e3def(0x209)]??_0x56b691[_0x5e3def(0x29e)];if(_0x347eba)_0x56b691={..._0x56b691,'path':_0x347eba};}'instructions'in _0x56b691&&!(_0x5e3def(0x2b8)in _0x56b691)&&(_0x56b691={..._0x56b691,'instruction':_0x56b691['instructions']});if(!(_0x5e3def(0x249)in _0x56b691)){const _0x267cb5=_0x56b691['code']??_0x56b691[_0x5e3def(0x283)]??_0x56b691['content']??_0x56b691[_0x5e3def(0x1ce)];if(_0x267cb5)_0x56b691={..._0x56b691,'code_edit':_0x267cb5};}}const _0x2a0b34=MorphEditFileArgsSchema[_0x5e3def(0x1ff)](_0x56b691);if(!_0x2a0b34[_0x5e3def(0x1ba)])throw new Error(_0x5e3def(0x1ca)+_0x2a0b34[_0x5e3def(0x25a)]);const _0x56c068=await validatePath(_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)]);let _0xec2481=null,_0x5a687a=!![],_0x519e46=null;try{_0xec2481=await a0_0x3ed385[_0x5e3def(0x194)](_0x56c068,_0x5e3def(0x1fb)),logger[_0x5e3def(0x1df)]('MCP','file_read_complete',{'path':_0x56c068,'size_bytes':_0xec2481['length']});}catch(_0x2a39e4){const _0x42d2d5=_0x2a39e4[_0x5e3def(0x22f)];_0x42d2d5==='ENOENT'?(_0x5a687a=![],_0xec2481='',logger[_0x5e3def(0x1df)]('MCP',_0x5e3def(0x275),{'path':_0x56c068,'exists':![]})):(_0x519e46='Failed\x20to\x20read\x20file:\x20'+(_0x42d2d5||_0x5e3def(0x27a))+_0x5e3def(0x2a2)+(_0x2a39e4 instanceof Error?_0x2a39e4[_0x5e3def(0x1b3)]:String(_0x2a39e4)),logger[_0x5e3def(0x25a)](_0x5e3def(0x288),'file_read_failed',{'path':_0x56c068,'error':_0x519e46}),logMcpStderr(_0x5e3def(0x28d)+_0x519e46));}let _0x50de33;try{const _0x74b61f=MORPH_API_KEY;if(!_0x74b61f)throw new Error(_0x5e3def(0x29a));const _0x30f222=a0_0x146359[_0x5e3def(0x1cd)](_0x56c068),_0x530ff9=a0_0x146359['basename'](_0x56c068);logger[_0x5e3def(0x1df)]('MCP','api_request_start',{'model':_0x5e3def(0x21d),'path':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)],'instruction_len':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x2b8)][_0x5e3def(0x217)],'code_edit_len':_0x2a0b34[_0x5e3def(0x2ba)]['code_edit']['length'],'original_code_len':_0xec2481?.[_0x5e3def(0x217)]??0x0,'dry_run':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)]});const _0x3cdd2b=Date[_0x5e3def(0x2bd)](),_0x577326=await executeEditFile({'target_filepath':_0x530ff9,'code_edit':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x249)],'instruction':_0x2a0b34['data'][_0x5e3def(0x2b8)]},{'morphApiKey':_0x74b61f,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x30f222,'autoWrite':!_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)],'generateUdiff':![],'debug':![]}),_0x5da451=Date[_0x5e3def(0x2bd)]()-_0x3cdd2b;_0x50de33=_0x577326[_0x5e3def(0x256)];if(!_0x577326[_0x5e3def(0x1ba)])throw new Error(_0x577326[_0x5e3def(0x25a)]||_0x5e3def(0x2bb));const _0x3ebb72=_0x577326[_0x5e3def(0x223)],_0x5ebbf0='added\x20'+_0x3ebb72[_0x5e3def(0x271)]+_0x5e3def(0x1f4)+_0x3ebb72[_0x5e3def(0x1bb)]+_0x5e3def(0x285)+_0x3ebb72[_0x5e3def(0x2a1)];logger[_0x5e3def(0x1df)](_0x5e3def(0x288),'tool_call_complete',{'tool':_0x5e3def(0x1ed),'success':!![],'latency_ms':Date['now']()-_0x4722eb,'edit_latency_ms':_0x5da451,'changes':{'added':_0x3ebb72[_0x5e3def(0x271)],'removed':_0x3ebb72[_0x5e3def(0x1bb)],'modified':_0x3ebb72['linesModified']},'completion_id':_0x50de33});if(_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)])return{'content':[{'type':'text','text':_0x5e3def(0x278)+(_0x5a687a?'':_0x5e3def(0x2b7))+':\x20'+_0x2a0b34['data'][_0x5e3def(0x2b8)]+_0x5e3def(0x2b1)+_0x5ebbf0+_0x5e3def(0x259)+_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)]+'.'}]};return{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x1d3)+(_0x5a687a?_0x5e3def(0x266):_0x5e3def(0x246))+':\x20'+_0x2a0b34['data'][_0x5e3def(0x2b8)]+'.\x20Changes:\x20'+_0x5ebbf0+'.\x20Path:\x20'+_0x2a0b34['data']['path']+'.'}]};}catch(_0x2d6fdc){const _0x525417=handleMorphAPIError(_0x2d6fdc);if(_0x525417)return logger[_0x5e3def(0x25a)](_0x5e3def(0x288),_0x5e3def(0x2a6),{'tool':'edit_file','error':_0x5e3def(0x2bc),'latency_ms':Date[_0x5e3def(0x2bd)]()-_0x4722eb}),_0x525417;const _0x2c0638=_0x2d6fdc instanceof Error?_0x2d6fdc['message']:String(_0x2d6fdc);return logger[_0x5e3def(0x25a)](_0x5e3def(0x288),_0x5e3def(0x2a6),{'tool':_0x5e3def(0x1ed),'error':_0x2c0638,'path':_0x2a0b34[_0x5e3def(0x2ba)]['path'],'validated_path':_0x56c068,'latency_ms':Date[_0x5e3def(0x2bd)]()-_0x4722eb,'stack':_0x2d6fdc instanceof Error?_0x2d6fdc['stack']:undefined}),reportMorphError({'error_message':_0x2c0638,'error_type':_0x2d6fdc instanceof Error?_0x2d6fdc[_0x5e3def(0x1e1)]['name']:'UnknownError','context':{'tool':'edit_file','completion_id':_0x50de33,'file_path':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)],'validated_path':_0x56c068,'instruction':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x2b8)],'model':MORPH_LARGE_APPLY?_0x5e3def(0x2af):_0x5e3def(0x21d),'dry_run':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)],'file_exists':_0x5a687a,'file_read_error':_0x519e46,'file_readable':_0xec2481!==null,'request_content':{'path':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)],'code_edit':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x249)],'instruction':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x2b8)],'original_code':_0xec2481!==null?_0xec2481['length']>0xc350?_0xec2481['substring'](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0xec2481[_0x5e3def(0x217)]+_0x5e3def(0x1bc):_0xec2481:_0x5e3def(0x221)+(_0x519e46||_0x5e3def(0x21a))+']','original_code_length':_0xec2481?.[_0x5e3def(0x217)]??0x0,'model':MORPH_LARGE_APPLY?_0x5e3def(0x2af):_0x5e3def(0x21d),'dry_run':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)]}},'stack_trace':_0x2d6fdc instanceof Error?_0x2d6fdc['stack']:undefined,'source':_0x5e3def(0x23e)})[_0x5e3def(0x2b3)](()=>{}),{'content':[{'type':'text','text':_0x5e3def(0x251)+_0x2c0638}],'isError':!![]};}}case TOOL_NAMES[_0x5e3def(0x2a8)]:{const _0x3e1cba=WarpGrepArgsSchema['safeParse'](_0x17d255);if(!_0x3e1cba[_0x5e3def(0x1ba)])return{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x210)+_0x3e1cba[_0x5e3def(0x25a)]}],'isError':!![]};const _0x354e70=_0x4e9df8=>{const _0x5e9832=_0x5e3def,_0x4ff32e=[];for(const _0x40e0d5 of _0x4e9df8||[]){if(_0x40e0d5['role']===_0x5e9832(0x231)&&Array[_0x5e9832(0x211)](_0x40e0d5[_0x5e9832(0x1be)]))for(const _0x555f59 of _0x40e0d5['tool_calls']){try{const _0x1ec239=_0x555f59[_0x5e9832(0x2aa)]?.[_0x5e9832(0x265)],_0x151d03=JSON[_0x5e9832(0x1af)](_0x555f59[_0x5e9832(0x2aa)]?.[_0x5e9832(0x1dd)]||'{}');if(_0x1ec239===_0x5e9832(0x24e))_0x4ff32e[_0x5e9832(0x1cc)](_0x5e9832(0x267)+_0x151d03[_0x5e9832(0x26a)]+'\x27\x20'+(_0x151d03['path']||'.'));else{if(_0x1ec239==='read')_0x4ff32e[_0x5e9832(0x1cc)]('read\x20'+_0x151d03['path']);else{if(_0x1ec239===_0x5e9832(0x195))_0x4ff32e[_0x5e9832(0x1cc)](_0x5e9832(0x216)+(_0x151d03[_0x5e9832(0x1fd)]||'.'));else{if(_0x1ec239==='glob')_0x4ff32e['push'](_0x5e9832(0x2a5)+_0x151d03[_0x5e9832(0x26a)]+'\x27\x20'+(_0x151d03[_0x5e9832(0x1aa)]||'.'));else _0x1ec239==='finish'&&_0x4ff32e['push']('finish');}}}}catch{}}}return _0x4ff32e;},_0x1be310=_0x3cdbc5=>{const _0x52bcd0=_0x5e3def,_0x3752de=[];if(!_0x3cdbc5||!Array[_0x52bcd0(0x211)](_0x3cdbc5))return _0x3752de;const _0x54b28d=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':'FileNotFound','tool':_0x52bcd0(0x2a4)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x52bcd0(0x2a4)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x52bcd0(0x1c3),'tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':_0x52bcd0(0x27f)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x52bcd0(0x2b5),'tool':_0x52bcd0(0x27f)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x52bcd0(0x1c3),'tool':_0x52bcd0(0x2a4)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x52bcd0(0x2a4)},{'pattern':/not a text file/,'error_type':_0x52bcd0(0x1c3),'tool':_0x52bcd0(0x2a4)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x52bcd0(0x2a4)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x52bcd0(0x2a4)},{'pattern':/status="error"/,'error_type':'ToolException','tool':'unknown'}];let _0x323080=0x0;for(const _0x1f88ea of _0x3cdbc5){_0x1f88ea[_0x52bcd0(0x243)]===_0x52bcd0(0x231)&&Array[_0x52bcd0(0x211)](_0x1f88ea[_0x52bcd0(0x1be)])&&_0x323080++;const _0x3d9d28=_0x1f88ea['content'];if((_0x1f88ea[_0x52bcd0(0x243)]==='tool'||_0x1f88ea['role']===_0x52bcd0(0x23a))&&_0x3d9d28&&typeof _0x3d9d28==='string')for(const {pattern:_0x765f10,error_type:_0x2a71e4,tool:_0x2f8d24}of _0x54b28d){const _0x548d32=_0x3d9d28[_0x52bcd0(0x1a6)](new RegExp(_0x765f10[_0x52bcd0(0x2b6)],'g'));if(_0x548d32)for(const _0x1e4ef6 of _0x548d32){const _0x38fd11=_0x3d9d28[_0x52bcd0(0x241)](_0x1e4ef6),_0x3b5757=_0x3d9d28['substring'](_0x38fd11,Math[_0x52bcd0(0x252)](_0x38fd11+0xc8,_0x3d9d28[_0x52bcd0(0x217)]));_0x3752de['push']({'tool':_0x2f8d24,'error_type':_0x2a71e4,'error_message':_0x3b5757[_0x52bcd0(0x22b)]('\x0a')[0x0],'turn':_0x323080});}}}return _0x3752de;};try{const _0x12f3f8=a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)]['repo_path']),_0x1d85bc=_0x3e1cba['data'][_0x5e3def(0x1ef)],_0x3d99af=_0x1d85bc===_0x5e3def(0x1a7)?{'allowNames':[_0x5e3def(0x1a7)]}:undefined,_0xf86700=new LocalRipgrepProvider(_0x12f3f8,undefined,_0x3d99af);logger[_0x5e3def(0x1df)]('MCP',_0x5e3def(0x25d),{'type':_0x5e3def(0x1f8),'repo_root':_0x12f3f8,'search_type':_0x1d85bc||_0x5e3def(0x2b4)}),logger[_0x5e3def(0x1df)](_0x5e3def(0x288),_0x5e3def(0x237),{'query':_0x3e1cba[_0x5e3def(0x2ba)]['search_string'],'repo_root':_0x12f3f8,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x3c7643=Date['now'](),_0x596820=await runWarpGrep({'searchTerm':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'repoRoot':_0x12f3f8,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0xf86700,'search_type':_0x1d85bc}),_0x3aae5a=Date[_0x5e3def(0x2bd)]()-_0x3c7643,_0x213dcf=_0x596820[_0x5e3def(0x215)]?.[_0x5e3def(0x24c)]?.[_0x5e3def(0x1bf)]?.[_0x5e3def(0x217)]??0x0;logger[_0x5e3def(0x1df)]('MCP',_0x5e3def(0x239),{'termination':_0x596820[_0x5e3def(0x1f0)],'turns':_0x596820[_0x5e3def(0x1d6)]?.[_0x5e3def(0x294)]??0x0,'files_found':_0x213dcf,'latency_ms':_0x3aae5a});const _0x5a0a0f=_0x1be310(_0x596820[_0x5e3def(0x1fc)]);_0x5a0a0f[_0x5e3def(0x217)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x5a0a0f[_0x5e3def(0x217)]+_0x5e3def(0x257),'error_type':_0x5e3def(0x254),'level':_0x5e3def(0x1b4),'tool':'codebase_search','context':{'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'model':_0x5e3def(0x264),'termination_reason':_0x596820[_0x5e3def(0x1f0)],'sub_tool_errors':_0x5a0a0f,'timings':_0x596820[_0x5e3def(0x1d6)],'tool_calls':_0x354e70(_0x596820[_0x5e3def(0x1fc)]),'messages':_0x596820[_0x5e3def(0x1fc)]?.[_0x5e3def(0x253)](_0x2b698f=>({'role':_0x2b698f[_0x5e3def(0x243)],'content':_0x2b698f[_0x5e3def(0x2c4)],..._0x2b698f[_0x5e3def(0x1be)]?{'tool_calls':_0x2b698f[_0x5e3def(0x1be)][_0x5e3def(0x217)]}:{},..._0x2b698f[_0x5e3def(0x1c4)]?{'tool_call_id':_0x2b698f[_0x5e3def(0x1c4)]}:{}}))},'source':_0x5e3def(0x23e)})[_0x5e3def(0x2b3)](()=>{});let _0x291421='';if(_0x596820[_0x5e3def(0x1f0)]===_0x5e3def(0x1ad)&&_0x596820[_0x5e3def(0x215)]?.[_0x5e3def(0x24c)]?.[_0x5e3def(0x1bf)]){const _0x5d70b5=_0x596820[_0x5e3def(0x215)]['metadata'][_0x5e3def(0x1bf)];if(_0x5d70b5['length']===0x0)return _0x291421=_0x596820[_0x5e3def(0x215)]['payload']||_0x5e3def(0x1a5),{'content':[{'type':_0x5e3def(0x286),'text':_0x291421}]};const _0x97cb89=[],_0x4545d3=[_0x5e3def(0x28b)];for(const _0x5197ca of _0x596820[_0x5e3def(0x1fc)]){if(_0x5197ca[_0x5e3def(0x243)]===_0x5e3def(0x231)&&Array[_0x5e3def(0x211)](_0x5197ca['tool_calls']))for(const _0x2e7713 of _0x5197ca[_0x5e3def(0x1be)]){try{const _0x38c924=_0x2e7713[_0x5e3def(0x2aa)]?.['name'],_0x5b8332=JSON[_0x5e3def(0x1af)](_0x2e7713[_0x5e3def(0x2aa)]?.[_0x5e3def(0x1dd)]||'{}');if(_0x38c924==='grep_search')_0x4545d3[_0x5e3def(0x1cc)](_0x5e3def(0x2b0)+_0x5b8332[_0x5e3def(0x26a)]+'\x27\x20in\x20`'+(_0x5b8332[_0x5e3def(0x1aa)]||'.')+'`');else{if(_0x38c924==='read')_0x4545d3[_0x5e3def(0x1cc)](_0x5e3def(0x20d)+_0x5b8332[_0x5e3def(0x1aa)]+'`');else{if(_0x38c924===_0x5e3def(0x195))_0x4545d3[_0x5e3def(0x1cc)](_0x5e3def(0x287)+(_0x5b8332[_0x5e3def(0x1fd)]||'.')+'`');else _0x38c924===_0x5e3def(0x19c)&&_0x4545d3[_0x5e3def(0x1cc)](_0x5e3def(0x1b7)+_0x5b8332['pattern']+_0x5e3def(0x27c)+(_0x5b8332[_0x5e3def(0x1aa)]||'.')+'`');}}}catch{}}}_0x97cb89[_0x5e3def(0x1cc)](_0x4545d3[_0x5e3def(0x1bd)]('\x0a'));const _0x57e931=['',_0x5e3def(0x201)];for(const _0x44c374 of _0x5d70b5){if(_0x44c374[_0x5e3def(0x233)]==='*')_0x57e931[_0x5e3def(0x1cc)]('-\x20'+_0x44c374['path']+':*');else{if(Array[_0x5e3def(0x211)](_0x44c374[_0x5e3def(0x233)])){const _0x70b752=_0x44c374[_0x5e3def(0x233)][_0x5e3def(0x253)](([_0x38d49f,_0x364940])=>{if(_0x38d49f===_0x364940)return''+_0x38d49f;return _0x38d49f+'-'+_0x364940;});_0x57e931[_0x5e3def(0x1cc)]('-\x20'+_0x44c374[_0x5e3def(0x1aa)]+':'+_0x70b752[_0x5e3def(0x1bd)](','));}else _0x57e931[_0x5e3def(0x1cc)]('-\x20'+_0x44c374[_0x5e3def(0x1aa)]+':*');}}_0x57e931[_0x5e3def(0x1cc)](''),_0x97cb89[_0x5e3def(0x1cc)](_0x57e931[_0x5e3def(0x1bd)]('\x0a')),_0x97cb89[_0x5e3def(0x1cc)]('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x6b2e2d=[],_0x574496=[];for(const _0x322db2 of _0x5d70b5){let _0x4fbeed=a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)]['repo_path'],_0x322db2['path']),_0x543c7c=null,_0x211b93=null;try{_0x543c7c=await a0_0x3ed385[_0x5e3def(0x194)](_0x4fbeed,{'encoding':'utf-8'});}catch(_0x43837d){const _0xd5ac3b=fixPathRepetition(_0x4fbeed);if(_0xd5ac3b)try{_0x543c7c=await a0_0x3ed385[_0x5e3def(0x194)](_0xd5ac3b,{'encoding':'utf-8'}),_0x4fbeed=_0xd5ac3b;}catch{_0x211b93=_0x43837d instanceof Error?_0x43837d:new Error(String(_0x43837d));}else _0x211b93=_0x43837d instanceof Error?_0x43837d:new Error(String(_0x43837d));}if(_0x543c7c!==null){const _0x2b6da9=_0x543c7c[_0x5e3def(0x22b)](/\r?\n/),_0x51ae93=[];if(_0x322db2[_0x5e3def(0x233)]==='*'||!Array['isArray'](_0x322db2[_0x5e3def(0x233)]))for(let _0x43651b=0x1;_0x43651b<=_0x2b6da9['length'];_0x43651b++){const _0x29b4ac=_0x2b6da9[_0x43651b-0x1];_0x51ae93[_0x5e3def(0x1cc)](_0x43651b+'|\x20'+_0x29b4ac);}else for(const [_0x4d5e4a,_0x4bcde4]of _0x322db2['lines']){_0x51ae93[_0x5e3def(0x217)]>0x0&&_0x51ae93['push']('');for(let _0x2b00a1=_0x4d5e4a;_0x2b00a1<=_0x4bcde4&&_0x2b00a1<=_0x2b6da9[_0x5e3def(0x217)];_0x2b00a1++){const _0x314a40=_0x2b6da9[_0x2b00a1-0x1];_0x51ae93['push'](_0x2b00a1+'|\x20'+_0x314a40);}}_0x574496[_0x5e3def(0x1cc)]({'path':_0x322db2[_0x5e3def(0x1aa)],'content':_0x51ae93[_0x5e3def(0x1bd)]('\x0a')});}else _0x6b2e2d[_0x5e3def(0x1cc)](_0x5e3def(0x2a7)+_0x322db2[_0x5e3def(0x1aa)]+_0x5e3def(0x22e)+(_0x211b93?.['message']||_0x5e3def(0x26b))+_0x5e3def(0x222));}try{const _0x41a2a2=await compactFileContexts(_0x574496,_0x3e1cba['data'][_0x5e3def(0x2a3)],MORPH_API_KEY,MORPH_API_URL);for(const _0x3760d3 of _0x41a2a2){_0x6b2e2d[_0x5e3def(0x1cc)](_0x5e3def(0x2a7)+_0x3760d3['path']+'\x22>\x0a'+_0x3760d3[_0x5e3def(0x2c4)]+_0x5e3def(0x222));}}catch(_0x259409){logger[_0x5e3def(0x1b4)](_0x5e3def(0x288),_0x5e3def(0x1f6),{'error':_0x259409 instanceof Error?_0x259409['message']:String(_0x259409),'files_count':_0x574496['length']});for(const _0x2ab428 of _0x574496){_0x6b2e2d[_0x5e3def(0x1cc)](_0x5e3def(0x2a7)+_0x2ab428['path']+_0x5e3def(0x1fe)+_0x2ab428[_0x5e3def(0x2c4)]+_0x5e3def(0x222));}}_0x97cb89[_0x5e3def(0x1cc)](_0x6b2e2d[_0x5e3def(0x1bd)]('\x0a\x0a')),_0x291421=_0x97cb89['join']('\x0a');const _0x427881=_0x596820[_0x5e3def(0x24a)]?.[_0x5e3def(0x255)](_0x1cb76c=>_0x1cb76c[_0x5e3def(0x1b3)]?.[_0x5e3def(0x1f2)](_0x5e3def(0x1d1)))||[];if(_0x427881[_0x5e3def(0x217)]>0x0){const _0x2028cc=_0x427881['map'](_0xb3f112=>_0xb3f112[_0x5e3def(0x1b3)])['join'](';\x20');reportMorphError({'error_message':_0x2028cc,'error_type':_0x5e3def(0x224),'context':{'tool':_0x5e3def(0x1e4),'repo_path':_0x3e1cba['data'][_0x5e3def(0x274)],'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'model':'morph-warp-grep-v2.1','termination_reason':_0x5e3def(0x2a9),'error_count':_0x427881[_0x5e3def(0x217)],'is_timeout':![],'timings':_0x596820[_0x5e3def(0x1d6)],'files_attempted':_0x5d70b5['map'](_0x2f7642=>({'path':_0x2f7642[_0x5e3def(0x1aa)],'lines':_0x2f7642[_0x5e3def(0x233)]})),'tool_calls':_0x354e70(_0x596820[_0x5e3def(0x1fc)]),'messages':_0x596820['messages']?.[_0x5e3def(0x253)](_0x23be47=>({'role':_0x23be47[_0x5e3def(0x243)],'content':_0x23be47[_0x5e3def(0x2c4)],..._0x23be47[_0x5e3def(0x1be)]?{'tool_calls':_0x23be47['tool_calls'][_0x5e3def(0x217)]}:{},..._0x23be47[_0x5e3def(0x1c4)]?{'tool_call_id':_0x23be47['tool_call_id']}:{}})),'request_content':{'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'repoRoot':a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)]),'model':_0x5e3def(0x264)}},'source':_0x5e3def(0x23e)})['catch'](()=>{});}}else{if(_0x596820['terminationReason']===_0x5e3def(0x22d)&&_0x596820[_0x5e3def(0x24a)][_0x5e3def(0x217)]>0x0){const _0x4e16f3=_0x596820['errors'][_0x5e3def(0x253)](_0x58cf8d=>_0x58cf8d[_0x5e3def(0x1b3)])[_0x5e3def(0x1bd)](';\x20');_0x291421=_0x5e3def(0x1a0)+_0x4e16f3;const _0x430324=_0x4e16f3['toLowerCase']()[_0x5e3def(0x273)](_0x5e3def(0x27e))||_0x4e16f3[_0x5e3def(0x235)]()[_0x5e3def(0x273)](_0x5e3def(0x2ac))||_0x4e16f3[_0x5e3def(0x235)]()[_0x5e3def(0x273)]('etimedout'),_0x2ff7be=_0x596820['finish']?.[_0x5e3def(0x24c)]?.[_0x5e3def(0x1bf)],_0x41ce65=_0x596820['errors'][0x0];reportMorphError({'error_message':_0x4e16f3,'error_type':_0x430324?'TimeoutError':_0x41ce65?.[_0x5e3def(0x1e1)]?.[_0x5e3def(0x265)]||_0x5e3def(0x1a9),'context':{'tool':_0x5e3def(0x1e4),'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'query':_0x3e1cba[_0x5e3def(0x2ba)]['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0x596820[_0x5e3def(0x1f0)],'error_count':_0x596820['errors']['length'],'is_timeout':_0x430324,'timings':_0x596820['timings'],'files_attempted':_0x2ff7be?.[_0x5e3def(0x253)](_0x4b8077=>({'path':_0x4b8077[_0x5e3def(0x1aa)],'lines':_0x4b8077[_0x5e3def(0x233)]})),'tool_calls':_0x354e70(_0x596820['messages']),'messages':_0x596820[_0x5e3def(0x1fc)]?.[_0x5e3def(0x253)](_0x5577bc=>({'role':_0x5577bc[_0x5e3def(0x243)],'content':_0x5577bc['content'],..._0x5577bc['tool_calls']?{'tool_calls':_0x5577bc['tool_calls']['length']}:{},..._0x5577bc[_0x5e3def(0x1c4)]?{'tool_call_id':_0x5577bc[_0x5e3def(0x1c4)]}:{}})),'request_content':{'query':_0x3e1cba['data'][_0x5e3def(0x2a3)],'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'repoRoot':a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)]),'model':_0x5e3def(0x264)}},'stack_trace':_0x41ce65?.['stack']||undefined,'source':_0x5e3def(0x23e)})['catch'](()=>{});}else _0x291421=_0x5e3def(0x218);}return{'content':[{'type':'text','text':_0x291421}]};}catch(_0x5e710e){const _0x59e9c4=handleMorphAPIError(_0x5e710e);if(_0x59e9c4)return logger[_0x5e3def(0x25a)](_0x5e3def(0x288),_0x5e3def(0x2a6),{'tool':_0x5e3def(0x1e4),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x5e3def(0x2bd)]()-_0x4722eb}),_0x59e9c4;const _0x4afad4=_0x5e710e instanceof Error?_0x5e710e[_0x5e3def(0x1b3)]:String(_0x5e710e);logger[_0x5e3def(0x25a)]('MCP',_0x5e3def(0x2a6),{'tool':_0x5e3def(0x1e4),'error':_0x4afad4,'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'latency_ms':Date[_0x5e3def(0x2bd)]()-_0x4722eb});const _0x50bfe7=_0x4afad4['toLowerCase']()[_0x5e3def(0x273)]('timeout')||_0x4afad4[_0x5e3def(0x235)]()[_0x5e3def(0x273)](_0x5e3def(0x2ac))||_0x4afad4[_0x5e3def(0x235)]()[_0x5e3def(0x273)](_0x5e3def(0x19e))||_0x5e710e instanceof Error&&_0x5e710e[_0x5e3def(0x265)]===_0x5e3def(0x2bf);return reportMorphError({'error_message':_0x4afad4,'error_type':_0x50bfe7?_0x5e3def(0x2bf):_0x5e710e instanceof Error?_0x5e710e[_0x5e3def(0x1e1)][_0x5e3def(0x265)]:_0x5e3def(0x213),'context':{'tool':_0x5e3def(0x1e4),'repo_path':_0x3e1cba['data'][_0x5e3def(0x274)],'query':_0x3e1cba['data']['search_string'],'model':_0x5e3def(0x264),'is_timeout':_0x50bfe7,'exception_phase':_0x5e3def(0x1d7),'request_content':{'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'repoRoot':a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x5e710e instanceof Error?_0x5e710e['stack']:undefined,'source':_0x5e3def(0x23e)})[_0x5e3def(0x2b3)](()=>{}),{'content':[{'type':_0x5e3def(0x286),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x4afad4}],'isError':![]};}}case TOOL_NAMES[_0x5e3def(0x21c)]:{const _0x364373=WarpGrepGitHubArgsSchema[_0x5e3def(0x1ff)](_0x17d255);if(!_0x364373[_0x5e3def(0x1ba)])return{'content':[{'type':_0x5e3def(0x286),'text':'Invalid\x20arguments:\x20'+_0x364373[_0x5e3def(0x25a)]}],'isError':!![]};const _0x29a3e7=_0x364373['data'][_0x5e3def(0x232)]||_0x364373['data'][_0x5e3def(0x196)];if(!_0x29a3e7)return{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x289)}],'isError':!![]};const _0x414d5a=MORPH_API_KEY;if(!_0x414d5a)throw new Error(_0x5e3def(0x29a));const _0x44d2e7=Date[_0x5e3def(0x2bd)]();logger[_0x5e3def(0x1df)](_0x5e3def(0x288),_0x5e3def(0x1fa),{'identifier':_0x29a3e7,'query':_0x364373[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'branch':_0x364373['data'][_0x5e3def(0x1eb)]});try{const _0x531bcf=new WarpGrepClient({'morphApiKey':_0x414d5a,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x20b161=await _0x531bcf[_0x5e3def(0x1ec)]({'searchTerm':_0x364373[_0x5e3def(0x2ba)]['search_string'],'github':_0x29a3e7,'branch':_0x364373[_0x5e3def(0x2ba)][_0x5e3def(0x1eb)]}),_0x3cacdc=Date[_0x5e3def(0x2bd)]()-_0x44d2e7;logMcpStderr(_0x5e3def(0x245)+_0x3cacdc+'ms.\x20Success:\x20'+_0x20b161[_0x5e3def(0x1ba)]);const _0x578200=formatResult(_0x20b161);return{'content':[{'type':'text','text':_0x578200}]};}catch(_0x5193d6){const _0x283217=handleMorphAPIError(_0x5193d6);if(_0x283217)return _0x283217;const _0x1c92c4=Date[_0x5e3def(0x2bd)]()-_0x44d2e7,_0x41c5bc=_0x5193d6 instanceof Error?_0x5193d6[_0x5e3def(0x1b3)]:String(_0x5193d6);return logMcpStderr('[github_codebase_search]\x20Failed\x20in\x20'+_0x1c92c4+_0x5e3def(0x227),_0x41c5bc),reportMorphError({'error_message':_0x41c5bc,'error_type':_0x5193d6 instanceof Error?_0x5193d6[_0x5e3def(0x1e1)][_0x5e3def(0x265)]:_0x5e3def(0x213),'context':{'tool':_0x5e3def(0x260),'github_url':_0x29a3e7,'search_string':_0x364373[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'branch':_0x364373[_0x5e3def(0x2ba)][_0x5e3def(0x1eb)]},'stack_trace':_0x5193d6 instanceof Error?_0x5193d6[_0x5e3def(0x20e)]:undefined,'source':_0x5e3def(0x23e),'tool':_0x5e3def(0x260),'latency_ms':_0x1c92c4})[_0x5e3def(0x2b3)](()=>{}),{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x2be)+_0x41c5bc}],'isError':![]};}}default:throw new Error(_0x5e3def(0x2c1)+_0x150814);}}catch(_0x38fb77){const _0x5975c8=_0x38fb77 instanceof Error?_0x38fb77[_0x5e3def(0x1b3)]:String(_0x38fb77);return reportMorphError({'error_message':_0x5975c8,'error_type':_0x38fb77 instanceof Error?_0x38fb77['constructor'][_0x5e3def(0x265)]:_0x5e3def(0x213),'context':{'tool':_0x150814,'arguments':_0x17d255?JSON[_0x5e3def(0x28c)](_0x17d255)[_0x5e3def(0x2c0)](0x0,0x1f4):undefined,'mcp_server_version':_0x5e3def(0x2b9)},'stack_trace':_0x38fb77 instanceof Error?_0x38fb77['stack']:undefined,'source':_0x5e3def(0x23e)})[_0x5e3def(0x2b3)](()=>{}),{'content':[{'type':'text','text':_0x5e3def(0x1a0)+_0x5975c8}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x569828){const _0x34ea3b=a0_0x231f6c,_0x4c4568=await getValidRootDirectories(_0x569828);if(_0x4c4568[_0x34ea3b(0x217)]>0x0)allowedDirectories=[..._0x4c4568],logMcpStderr(_0x34ea3b(0x1d5)+_0x4c4568[_0x34ea3b(0x217)]+_0x34ea3b(0x1ee));else{logMcpStderr(_0x34ea3b(0x291));if(ENABLE_WORKSPACE_MODE)try{const _0x62e1f4=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x62e1f4&&(allowedDirectories=[_0x62e1f4],logMcpStderr(_0x34ea3b(0x28a)+_0x62e1f4));}catch(_0x5cabd2){logMcpStderr(_0x34ea3b(0x225)+_0x5cabd2);}}}server[a0_0x231f6c(0x24f)](RootsListChangedNotificationSchema,async()=>{const _0x1da150=a0_0x231f6c;try{const _0x1e72a8=await server[_0x1da150(0x229)]();_0x1e72a8&&'roots'in _0x1e72a8&&await updateAllowedDirectoriesFromRoots(_0x1e72a8['roots']);}catch(_0x10ae8e){logMcpStderr(_0x1da150(0x296),_0x10ae8e instanceof Error?_0x10ae8e[_0x1da150(0x1b3)]:String(_0x10ae8e));}}),server[a0_0x231f6c(0x1d8)]=async()=>{const _0x3fa1c2=a0_0x231f6c,_0x4e661a=server[_0x3fa1c2(0x281)]();if(_0x4e661a?.[_0x3fa1c2(0x272)])try{const _0x540d01=await server[_0x3fa1c2(0x229)]();_0x540d01&&_0x3fa1c2(0x272)in _0x540d01?await updateAllowedDirectoriesFromRoots(_0x540d01[_0x3fa1c2(0x272)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x1d088d){logMcpStderr(_0x3fa1c2(0x1ea),_0x1d088d instanceof Error?_0x1d088d[_0x3fa1c2(0x1b3)]:String(_0x1d088d));}else{if(allowedDirectories[_0x3fa1c2(0x217)]>0x0)logMcpStderr(_0x3fa1c2(0x1e6),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0x3fa1c2(0x208));}}};async function runServer(){const _0x5aa2c4=a0_0x231f6c,_0x52bdab=new StdioServerTransport();await server['connect'](_0x52bdab),logMcpStderr('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories[_0x5aa2c4(0x217)]===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()['catch'](_0x220812=>{const _0x5414e6=a0_0x231f6c;logMcpStderr(_0x5414e6(0x1e0),_0x220812),process[_0x5414e6(0x27d)](0x1);});
|
package/dist/log-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a1_0x14162f=a1_0x9ec8;(function(_0x53e503,_0x103f9c){var _0x59187e=a1_0x9ec8,_0x1311ae=_0x53e503();while(!![]){try{var _0x38cccd=parseInt(_0x59187e(0x79))/0x1+parseInt(_0x59187e(0x74))/0x2+parseInt(_0x59187e(0x87))/0x3*(parseInt(_0x59187e(0x88))/0x4)+-parseInt(_0x59187e(0x85))/0x5+-parseInt(_0x59187e(0x7a))/0x6*(parseInt(_0x59187e(0x7b))/0x7)+-parseInt(_0x59187e(0x7c))/0x8*(-parseInt(_0x59187e(0x7e))/0x9)+-parseInt(_0x59187e(0x7d))/0xa*(parseInt(_0x59187e(0x77))/0xb);if(_0x38cccd===_0x103f9c)break;else _0x1311ae['push'](_0x1311ae['shift']());}catch(_0x384238){_0x1311ae['push'](_0x1311ae['shift']());}}}(a1_0x46dc,0x883dc));import a1_0x3ccd86 from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0xcb0c92=a1_0x3ccd86[a1_0x14162f(0x86)]()){var _0x24dd3f=a1_0x14162f;switch(_0xcb0c92){case _0x24dd3f(0x7f):return _0x24dd3f(0x80);case'win32':return _0x24dd3f(0x78);case'linux':return _0x24dd3f(0x75);default:return _0x24dd3f(0x76);}}function a1_0x9ec8(_0x877ac5,_0x4980e6){_0x877ac5=_0x877ac5-0x73;var _0x46dc9b=a1_0x46dc();var _0x9ec87a=_0x46dc9b[_0x877ac5];return _0x9ec87a;}export function formatMcpLogMessage(_0x3794f2,_0x245a0d=a1_0x3ccd86['platform']()){var _0x50c657=a1_0x14162f;return _0x50c657(0x83)+getOperatingSystemType(_0x245a0d)+']\x20'+_0x3794f2;}function a1_0x46dc(){var _0x1c3cee=['538777cWZNNj','2441958rILkhM','7dpaIOE','345480kWtgFZ','6910jxiezx','153Adjsht','darwin','macOS','length','info','[os=','MCP','11330sVNvJS','platform','3YfoyIP','3465184RTTSXY','error','834770yDCqKV','Linux','Unknown','25300AYejpk','Windows'];a1_0x46dc=function(){return _0x1c3cee;};return a1_0x46dc();}export function logMcpStderr(_0x95e4fd,..._0x5b9036){var _0xa0ec25=a1_0x14162f;console[_0xa0ec25(0x73)](formatMcpLogMessage(_0x95e4fd),..._0x5b9036),logger[_0xa0ec25(0x82)](_0xa0ec25(0x84),_0x95e4fd,_0x5b9036[_0xa0ec25(0x81)]?{'args':_0x5b9036['map'](_0x30bb23=>String(_0x30bb23))}:undefined);}
|
package/dist/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a2_0x14ef(){const _0x2a2494=['1WTSDqT','63NSPhEB','toUpperCase','error','6928OhQDaN','4298UTmsuW','isEnabled','1941366xfuHgU',']\x20[','enable','stringify','env','24047716cmyffe','834550ZTHxTp','enabled','debug','fileStream','3118095TbIoge','warn','12brxwqT','_log','1154434bjDeGr','MORPH_LOG_FILE','MORPH_DEBUG','write','508884HjSCGe','info'];a2_0x14ef=function(){return _0x2a2494;};return a2_0x14ef();}const a2_0x412cae=a2_0x54fd;(function(_0x5678b3,_0x3540d8){const _0x517885=a2_0x54fd,_0x9d9109=_0x5678b3();while(!![]){try{const _0x3dbc8b=parseInt(_0x517885(0xb8))/0x1*(parseInt(_0x517885(0xb2))/0x2)+parseInt(_0x517885(0xb0))/0x3*(parseInt(_0x517885(0xb6))/0x4)+parseInt(_0x517885(0xae))/0x5+-parseInt(_0x517885(0xbf))/0x6+-parseInt(_0x517885(0xbd))/0x7*(-parseInt(_0x517885(0xbc))/0x8)+-parseInt(_0x517885(0xb9))/0x9*(-parseInt(_0x517885(0xaa))/0xa)+-parseInt(_0x517885(0xc4))/0xb;if(_0x3dbc8b===_0x3540d8)break;else _0x9d9109['push'](_0x9d9109['shift']());}catch(_0x28e704){_0x9d9109['push'](_0x9d9109['shift']());}}}(a2_0x14ef,0x4d208));import{createWriteStream}from'fs';function a2_0x54fd(_0x37b61f,_0x34a80b){_0x37b61f=_0x37b61f-0xaa;const _0x14ef34=a2_0x14ef();let _0x54fdfc=_0x14ef34[_0x37b61f];return _0x54fdfc;}class MorphLogger{[a2_0x412cae(0xab)];['fileStream'];constructor(){const _0xda4fa3=a2_0x412cae;this[_0xda4fa3(0xab)]=process[_0xda4fa3(0xc3)][_0xda4fa3(0xb4)]==='1'||!!process[_0xda4fa3(0xc3)][_0xda4fa3(0xb3)];const _0x2f3e05=process[_0xda4fa3(0xc3)][_0xda4fa3(0xb3)];this[_0xda4fa3(0xad)]=_0x2f3e05?createWriteStream(_0x2f3e05,{'flags':'a'}):null;}['debug'](_0x3b90d6,_0x3eae38,_0xb44cb8){const _0x578af7=a2_0x412cae;this[_0x578af7(0xb1)](_0x578af7(0xac),_0x3b90d6,_0x3eae38,_0xb44cb8);}[a2_0x412cae(0xb7)](_0x2cae50,_0x11b4aa,_0x3045ef){const _0x2504d=a2_0x412cae;this['_log'](_0x2504d(0xb7),_0x2cae50,_0x11b4aa,_0x3045ef);}[a2_0x412cae(0xaf)](_0x55407d,_0x20fcef,_0x45bd8e){const _0xf712c5=a2_0x412cae;this['_log'](_0xf712c5(0xaf),_0x55407d,_0x20fcef,_0x45bd8e);}[a2_0x412cae(0xbb)](_0x211ebd,_0xb6564f,_0x152ced){const _0x480e72=a2_0x412cae;this[_0x480e72(0xb1)](_0x480e72(0xbb),_0x211ebd,_0xb6564f,_0x152ced);}[a2_0x412cae(0xc1)](){const _0x1fa57c=a2_0x412cae;this[_0x1fa57c(0xab)]=!![];}get[a2_0x412cae(0xbe)](){return this['enabled'];}[a2_0x412cae(0xb1)](_0x5f0756,_0x4c3fe9,_0x5e742a,_0x472ac9){const _0x2ac966=a2_0x412cae;if(_0x5f0756!=='error'&&!this[_0x2ac966(0xab)])return;const _0x4484ef=new Date()['toISOString'](),_0x21bb51='['+_0x4484ef+_0x2ac966(0xc0)+_0x5f0756[_0x2ac966(0xba)]()+_0x2ac966(0xc0)+_0x4c3fe9+']';console[_0x2ac966(0xbb)](_0x472ac9?_0x21bb51+'\x20'+_0x5e742a+'\x20'+JSON[_0x2ac966(0xc2)](_0x472ac9):_0x21bb51+'\x20'+_0x5e742a),this[_0x2ac966(0xad)]?.[_0x2ac966(0xb5)](JSON[_0x2ac966(0xc2)]({'ts':_0x4484ef,'level':_0x5f0756,'component':_0x4c3fe9,'msg':_0x5e742a,..._0x472ac9&&{'data':_0x472ac9}})+'\x0a');}}export const logger=new MorphLogger();
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x15a3fd,_0x1aa299){const _0x296ac5=a3_0x3639,_0x197a93=_0x15a3fd();while(!![]){try{const _0x258abe=-parseInt(_0x296ac5(0x6f))/0x1+parseInt(_0x296ac5(0x73))/0x2*(-parseInt(_0x296ac5(0x6b))/0x3)+-parseInt(_0x296ac5(0x6c))/0x4*(-parseInt(_0x296ac5(0x78))/0x5)+parseInt(_0x296ac5(0x66))/0x6*(-parseInt(_0x296ac5(0x65))/0x7)+-parseInt(_0x296ac5(0x75))/0x8+parseInt(_0x296ac5(0x69))/0x9*(parseInt(_0x296ac5(0x70))/0xa)+parseInt(_0x296ac5(0x72))/0xb;if(_0x258abe===_0x1aa299)break;else _0x197a93['push'](_0x197a93['shift']());}catch(_0x387153){_0x197a93['push'](_0x197a93['shift']());}}}(a3_0x45fe,0x5dbb2));function a3_0x3639(_0x29c628,_0x1517dc){_0x29c628=_0x29c628-0x64;const _0x45fed9=a3_0x45fe();let _0x363925=_0x45fed9[_0x29c628];return _0x363925;}import a3_0x51aee4 from'path';import a3_0x469a8c from'os';export function convertToWindowsPath(_0x28e1e6){const _0x359f2b=a3_0x3639;if(_0x28e1e6['startsWith'](_0x359f2b(0x64))){const _0x3d06e=_0x28e1e6[_0x359f2b(0x74)](0x5)[_0x359f2b(0x67)](),_0x18f1cc=_0x28e1e6[_0x359f2b(0x71)](0x6)[_0x359f2b(0x68)](/\//g,'\x5c');return _0x3d06e+':'+_0x18f1cc;}if(_0x28e1e6[_0x359f2b(0x77)](/^\/[a-zA-Z]\//)){const _0x93cb02=_0x28e1e6[_0x359f2b(0x74)](0x1)['toUpperCase'](),_0x4354c5=_0x28e1e6[_0x359f2b(0x71)](0x2)['replace'](/\//g,'\x5c');return _0x93cb02+':'+_0x4354c5;}if(_0x28e1e6[_0x359f2b(0x77)](/^[a-zA-Z]:/))return _0x28e1e6[_0x359f2b(0x68)](/\//g,'\x5c');return _0x28e1e6;}export function normalizePath(_0x24f235){const _0x4b1c37=a3_0x3639;_0x24f235=_0x24f235[_0x4b1c37(0x76)]()[_0x4b1c37(0x68)](/^["']|["']$/g,'');const _0x51aa4c=_0x24f235['startsWith']('/')&&!_0x24f235[_0x4b1c37(0x77)](/^\/mnt\/[a-z]\//i)&&!_0x24f235[_0x4b1c37(0x77)](/^\/[a-zA-Z]\//);if(_0x51aa4c)return _0x24f235['replace'](/\/+/g,'/')[_0x4b1c37(0x68)](/\/+$/,'');_0x24f235=convertToWindowsPath(_0x24f235);if(_0x24f235[_0x4b1c37(0x6d)]('\x5c\x5c')){let _0x135fee=_0x24f235;_0x135fee=_0x135fee[_0x4b1c37(0x68)](/^\\{2,}/,'\x5c\x5c');const _0xd4c412=_0x135fee[_0x4b1c37(0x79)](0x2)[_0x4b1c37(0x68)](/\\\\/g,'\x5c');_0x24f235='\x5c\x5c'+_0xd4c412;}else _0x24f235=_0x24f235[_0x4b1c37(0x68)](/\\\\/g,'\x5c');let _0x11272f=a3_0x51aee4['normalize'](_0x24f235);_0x24f235[_0x4b1c37(0x6d)]('\x5c\x5c')&&!_0x11272f[_0x4b1c37(0x6d)]('\x5c\x5c')&&(_0x11272f='\x5c'+_0x11272f);if(_0x11272f[_0x4b1c37(0x77)](/^[a-zA-Z]:/)){let _0x922950=_0x11272f['replace'](/\//g,'\x5c');return/^[a-z]:/[_0x4b1c37(0x6e)](_0x922950)&&(_0x922950=_0x922950[_0x4b1c37(0x74)](0x0)['toUpperCase']()+_0x922950[_0x4b1c37(0x71)](0x1)),_0x922950;}return _0x11272f['replace'](/\//g,'\x5c');}export function expandHome(_0x5dca1d){const _0x279e61=a3_0x3639;if(_0x5dca1d[_0x279e61(0x6d)]('~/')||_0x5dca1d==='~')return a3_0x51aee4[_0x279e61(0x6a)](a3_0x469a8c['homedir'](),_0x5dca1d[_0x279e61(0x71)](0x1));return _0x5dca1d;}function a3_0x45fe(){const _0x166f4f=['charAt','734464KELybu','trim','match','5nmnBWq','substring','/mnt/','336MfbiwS','65424GJliwU','toUpperCase','replace','9qsRMjN','join','844161AURwki','616876agxReA','startsWith','test','317294ILiIau','2739650KNfDiw','slice','12865809wIUnWO','2OhFVZw'];a3_0x45fe=function(){return _0x166f4f;};return a3_0x45fe();}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xc56a2c,_0x5c1286){const _0x3e0e7b=a4_0x3ace,_0x278a9f=_0xc56a2c();while(!![]){try{const _0x19a658=parseInt(_0x3e0e7b(0x127))/0x1+-parseInt(_0x3e0e7b(0x121))/0x2+-parseInt(_0x3e0e7b(0x12a))/0x3+-parseInt(_0x3e0e7b(0x124))/0x4+-parseInt(_0x3e0e7b(0x128))/0x5+-parseInt(_0x3e0e7b(0x12f))/0x6+parseInt(_0x3e0e7b(0x12c))/0x7*(parseInt(_0x3e0e7b(0x125))/0x8);if(_0x19a658===_0x5c1286)break;else _0x278a9f['push'](_0x278a9f['shift']());}catch(_0x4c3a05){_0x278a9f['push'](_0x278a9f['shift']());}}}(a4_0x33b2,0xd83c6));function a4_0x3ace(_0x24d1d1,_0x4621e3){_0x24d1d1=_0x24d1d1-0x11e;const _0x33b201=a4_0x33b2();let _0x3ace13=_0x33b201[_0x24d1d1];return _0x3ace13;}import a4_0x4a1cd4 from'path';function a4_0x33b2(){const _0x487d5c=['startsWith','includes','594452CSPuHz','40adDFeE','isArray','1262292jMDBEn','3119855ivWbWZ','Path\x20must\x20be\x20absolute\x20after\x20normalization','2529699XydWlh','resolve','3616991urihlN','some','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','1889034eluZJZ','isAbsolute','sep','length','normalize','string','2058998XcIjTy'];a4_0x33b2=function(){return _0x487d5c;};return a4_0x33b2();}export function isPathWithinAllowedDirectories(_0x4ad033,_0x2b604a){const _0xaa7a=a4_0x3ace;if(typeof _0x4ad033!==_0xaa7a(0x120)||!Array[_0xaa7a(0x126)](_0x2b604a))return![];if(!_0x4ad033||_0x2b604a[_0xaa7a(0x11e)]===0x0)return![];if(_0x4ad033[_0xaa7a(0x123)]('\x00'))return![];let _0x1ecb5e;try{_0x1ecb5e=a4_0x4a1cd4[_0xaa7a(0x12b)](a4_0x4a1cd4[_0xaa7a(0x11f)](_0x4ad033));}catch{return![];}if(!a4_0x4a1cd4[_0xaa7a(0x130)](_0x1ecb5e))throw new Error(_0xaa7a(0x129));return _0x2b604a[_0xaa7a(0x12d)](_0x21179b=>{const _0x57f04e=_0xaa7a;if(typeof _0x21179b!==_0x57f04e(0x120)||!_0x21179b)return![];if(_0x21179b[_0x57f04e(0x123)]('\x00'))return![];let _0x3968f2;try{_0x3968f2=a4_0x4a1cd4[_0x57f04e(0x12b)](a4_0x4a1cd4['normalize'](_0x21179b));}catch{return![];}if(!a4_0x4a1cd4[_0x57f04e(0x130)](_0x3968f2))throw new Error(_0x57f04e(0x12e));if(_0x1ecb5e===_0x3968f2)return!![];if(_0x3968f2===a4_0x4a1cd4['sep'])return _0x1ecb5e[_0x57f04e(0x122)](a4_0x4a1cd4[_0x57f04e(0x131)]);return _0x1ecb5e[_0x57f04e(0x122)](_0x3968f2+a4_0x4a1cd4[_0x57f04e(0x131)]);});}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4783da,_0x1c4ed2){const _0x22c928=a5_0x5dbf,_0x7a3cd6=_0x4783da();while(!![]){try{const _0x380c09=parseInt(_0x22c928(0x98))/0x1*(parseInt(_0x22c928(0x9b))/0x2)+parseInt(_0x22c928(0x91))/0x3*(-parseInt(_0x22c928(0x8c))/0x4)+parseInt(_0x22c928(0xa0))/0x5*(-parseInt(_0x22c928(0x93))/0x6)+parseInt(_0x22c928(0x9c))/0x7*(parseInt(_0x22c928(0x9a))/0x8)+parseInt(_0x22c928(0x9f))/0x9+parseInt(_0x22c928(0x94))/0xa*(-parseInt(_0x22c928(0x96))/0xb)+-parseInt(_0x22c928(0xa1))/0xc;if(_0x380c09===_0x1c4ed2)break;else _0x7a3cd6['push'](_0x7a3cd6['shift']());}catch(_0x3c984d){_0x7a3cd6['push'](_0x7a3cd6['shift']());}}}(a5_0x2f6f,0xe04ec));import{promises as a5_0x2cf053}from'fs';function a5_0x5dbf(_0x37464c,_0x3fe048){_0x37464c=_0x37464c-0x8a;const _0x2f6f4c=a5_0x2f6f();let _0x5dbf39=_0x2f6f4c[_0x37464c];return _0x5dbf39;}import a5_0x38ed9d from'path';function a5_0x2f6f(){const _0x4a6357=['2064PvVVuj','2gHkgEH','43393JDjivf','resolve','isDirectory','13859154MvZvzX','20bTUcGO','14778348NWapwF','realpath','Skipping\x20invalid\x20directory:\x20','invalid\x20path\x20or\x20inaccessible','stat','3520lzGMzk','slice','push','uri','join','1041QiAeim','message','1694724JLspox','310CtCsHu','startsWith','78298fbHIwH','Skipping\x20','666879YcdZqi','file://'];a5_0x2f6f=function(){return _0x4a6357;};return a5_0x2f6f();}import a5_0x262723 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x6ef63d){const _0x3c86b4=a5_0x5dbf;try{const _0x1b6a0a=_0x6ef63d[_0x3c86b4(0x95)](_0x3c86b4(0x99))?_0x6ef63d['slice'](0x7):_0x6ef63d,_0x4c48d4=_0x1b6a0a[_0x3c86b4(0x95)]('~/')||_0x1b6a0a==='~'?a5_0x38ed9d[_0x3c86b4(0x90)](a5_0x262723['homedir'](),_0x1b6a0a[_0x3c86b4(0x8d)](0x1)):_0x1b6a0a,_0xda8079=a5_0x38ed9d[_0x3c86b4(0x9d)](_0x4c48d4),_0x595796=await a5_0x2cf053[_0x3c86b4(0xa2)](_0xda8079);return normalizePath(_0x595796);}catch{return null;}}function formatDirectoryError(_0x113101,_0x522bb0,_0x3e93cc){const _0x44d2a3=a5_0x5dbf;if(_0x3e93cc)return _0x44d2a3(0x97)+_0x3e93cc+':\x20'+_0x113101;const _0x919858=_0x522bb0 instanceof Error?_0x522bb0[_0x44d2a3(0x92)]:String(_0x522bb0);return _0x44d2a3(0xa3)+_0x113101+'\x20due\x20to\x20error:\x20'+_0x919858;}export async function getValidRootDirectories(_0x400539){const _0x1545d=a5_0x5dbf,_0x4e0063=[];for(const _0x4345c7 of _0x400539){const _0x50d16c=await parseRootUri(_0x4345c7['uri']);if(!_0x50d16c){logMcpStderr(formatDirectoryError(_0x4345c7[_0x1545d(0x8f)],undefined,_0x1545d(0x8a)));continue;}try{const _0x4e5ca6=await a5_0x2cf053[_0x1545d(0x8b)](_0x50d16c);_0x4e5ca6[_0x1545d(0x9e)]()?_0x4e0063[_0x1545d(0x8e)](_0x50d16c):logMcpStderr(formatDirectoryError(_0x50d16c,undefined,'non-directory\x20root'));}catch(_0x1ac2bd){logMcpStderr(formatDirectoryError(_0x50d16c,_0x1ac2bd));}}return _0x4e0063;}
|
package/dist/tool-definitions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a6_0x2b9c34=a6_0x1718;(function(_0x281d16,_0x55aba0){const _0x517849=a6_0x1718,_0x3d0172=_0x281d16();while(!![]){try{const _0x4a9447=parseInt(_0x517849(0x19b))/0x1*(parseInt(_0x517849(0x199))/0x2)+-parseInt(_0x517849(0x1a1))/0x3+-parseInt(_0x517849(0x19e))/0x4*(-parseInt(_0x517849(0x1a3))/0x5)+-parseInt(_0x517849(0x198))/0x6*(-parseInt(_0x517849(0x1a4))/0x7)+parseInt(_0x517849(0x19f))/0x8+parseInt(_0x517849(0x1a2))/0x9+-parseInt(_0x517849(0x197))/0xa*(parseInt(_0x517849(0x1a0))/0xb);if(_0x4a9447===_0x55aba0)break;else _0x3d0172['push'](_0x3d0172['shift']());}catch(_0x41ab8f){_0x3d0172['push'](_0x3d0172['shift']());}}}(a6_0x113e,0x47a8d));export const TOOL_NAMES={'EDIT_FILE':a6_0x2b9c34(0x19c),'CODEBASE_SEARCH':a6_0x2b9c34(0x19a),'GITHUB_CODEBASE_SEARCH':'github_codebase_search'};function a6_0x113e(){const _0x79f768=['1727VcqRdX','1249560PZVtRO','3591549NLvzsJ','30575iHImTK','7vJexTg','75880XpVcDv','1031736VteCje','694994QyxNpr','codebase_search','1UmVAsy','edit_file','values','268XWmEZS','4585072lBbuFS'];a6_0x113e=function(){return _0x79f768;};return a6_0x113e();}export const ALL_TOOL_NAMES=Object[a6_0x2b9c34(0x19d)](TOOL_NAMES);function a6_0x1718(_0x11134f,_0x4d674f){_0x11134f=_0x11134f-0x197;const _0x113e09=a6_0x113e();let _0x171867=_0x113e09[_0x11134f];return _0x171867;}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.181",
|
|
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.171",
|
|
39
39
|
"@vscode/ripgrep": "^1.15.14",
|
|
40
40
|
"axios": "^1.6.0",
|
|
41
41
|
"chalk": "^5.3.0",
|