@morphllm/morphmcp 0.8.203 → 0.8.204

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const a0_0x2a3250=a0_0x3b4c;(function(_0x3276d0,_0x1a27a2){const _0xb0fe13=a0_0x3b4c,_0x416e47=_0x3276d0();while(!![]){try{const _0xa31551=parseInt(_0xb0fe13(0x24e))/0x1*(-parseInt(_0xb0fe13(0x1cf))/0x2)+parseInt(_0xb0fe13(0x16a))/0x3*(parseInt(_0xb0fe13(0x18d))/0x4)+-parseInt(_0xb0fe13(0x219))/0x5*(-parseInt(_0xb0fe13(0x1d5))/0x6)+parseInt(_0xb0fe13(0x22f))/0x7+-parseInt(_0xb0fe13(0x211))/0x8+parseInt(_0xb0fe13(0x23a))/0x9*(parseInt(_0xb0fe13(0x23c))/0xa)+-parseInt(_0xb0fe13(0x273))/0xb;if(_0xa31551===_0x1a27a2)break;else _0x416e47['push'](_0x416e47['shift']());}catch(_0x3b6dbd){_0x416e47['push'](_0x416e47['shift']());}}}(a0_0x292b,0x881c9));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_0x5e0960 from'fs/promises';import a0_0x5373b1 from'path';import a0_0x43429b from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{logger}from'./logger.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';function a0_0x3b4c(_0x2cfc27,_0x4d9484){_0x2cfc27=_0x2cfc27-0x165;const _0x292bdd=a0_0x292b();let _0x3b4c7f=_0x292bdd[_0x2cfc27];return _0x3b4c7f;}import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0x533768 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function a0_0x292b(){const _0x25c457=['sk-','MORPH_API_URL','-\x20Grepped\x20\x27','File\x20read\x20error:','false','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','finish','github_url','937978ZGIEoA','-\x20Listed\x20directory\x20`','listRoots','Parent\x20directory\x20does\x20not\x20exist:\x20','length','ENABLE_WORKSPACE_MODE','768VlPyUw','SymlinkError','Parameters:\x0a','files','status','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','file_read_failed','basename','[github_codebase_search]\x20Done\x20in\x20','tool_calls','added\x20','timeout','BinaryFile','Applied','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','https://morphllm.com/api/error-report','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','tool_call_complete','default','env','stack','safeParse','`\x20in\x20`','slice','PathError','repo_path','MCP','indexOf','code_edit','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','tool_call_error','number','WarpGrepError','Unknown\x20tool:\x20','text','Failed\x20to\x20request\x20roots\x20from\x20client:','-\x20Read\x20file\x20`','errors','\x22>\x0a','map','readFile','target_filepath','source','sep','join','access','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','Morph\x20FastApply\x20failed\x20without\x20error\x20message','Morph\x20Edit\x20','Warning:\x20','isArray','pyproject.toml','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','warn','lines','constructor','4405408UXmaWB','.vscode','Disabled\x20tools:\x20','SubToolError','command','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','40720YlUOsi','now','name','resolve','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','Error\x20running\x20fast\x20context\x20search:\x20','morph-warp-grep-v2.1','stat','file','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','requiresApiKey','glob','branch','path_validation_resolved','Unknown\x20error','search_string','Example\x20format:\x0a','unknown','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','message','Error:\x20','.\x20Changes:\x20','3157070RNoUic','morph-v3-fast','<file\x20path=\x22','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.','instructions','toLowerCase','0.2.0','role','UnknownError','payload','code','950688cTieTf','stringify','20NmOyJT','composer.json','EDIT_FILE','includes','substring','searchGitHub','terminationReason','every','completionId','Fatal\x20error\x20running\x20server:','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','list_directory','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','\x20\x20morph-mcp','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','grep_search','Fallback:\x20Using\x20workspace\x20root\x20','2ZcsJKa','tsconfig.json','edit','has','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','error','tool_call_received','metadata','Specific\x20commit\x20hash\x20to\x20search','TimeoutError','instruction','Morph\x20Edit\x20Preview','log','version','ENOENT','provider_created','inputSchema','messages','Preview\x20changes\x20without\x20applying\x20them.','some','data','search_type','setNotificationHandler','Created\x20File','\x20as\x20allowed\x20directory','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','filePath','GITHUB_CODEBASE_SEARCH','package.json','arguments','compaction_failed','RipgrepError','linesRemoved','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','warp_grep_start','path','.git','6332392IkRBiE','optional','Repository\x20identifier','dryRun','object','getClientCapabilities','read\x20','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','github_codebase_search','Error\x20accessing\x20directory\x20','match','array','node_modules','codebase_search','\x0aExamples:','path_validation_failed','parse','application/json','WarpGrep\x20sub-tool\x20errors:\x20','\x20chars)','\x0aOptions:','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','post','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','file_read_complete','new_string','startsWith','Failed\x20to\x20read\x20file:\x20','realpath','MORPH_WARP_GREP_TIMEOUT','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','read','mcp-filesystem','edit_file','filter','1071cdEygv','\x0a</file>','dirname','toISOString','ms:','etimedout','LocalRipgrepProvider','--help','turns','floor','exit','PWD','changes','Tool\x20\x22','string','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.','**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','\x20is\x20not\x20a\x20directory','ReadError','runWarpGrep_call','linesModified','pattern','assistant','catch','timings','Warning:\x20Workspace\x20fallback\x20failed:\x20','homedir','Here\x20is\x20the\x20content\x20of\x20files:\x0a','morph-mcp','DISABLED_TOOLS','warp_grep_complete','user','morph-v3-large','split','go.mod','10276wQNgsm','debug','describe','connect','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','API\x20error\x20(auth/rate-limit)','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Max\x20results\x20to\x20return','\x20valid\x20directories','\x20-\x20','ToolException','\x22>\x0aError\x20reading\x20file:\x20','params','utf-8','grep','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','response','Cargo.toml','[could\x20not\x20read\x20file:\x20','Bearer\x20','CODEBASE_SEARCH','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','oninitialized','--api-key=','description','success','.\x20Path:\x20','api-key','roots','function','\x20disabled\x20via\x20DISABLED_TOOLS','size','WHEN\x20TO\x20USE\x20vs\x20native\x20edit/patch\x20tools:\x20prefer\x20this\x20tool\x20for\x20large\x20files,\x20multiple\x20or\x20scattered\x20edits,\x20refactors,\x20and\x20whitespace-sensitive\x20changes.\x20A\x20single\x20tiny\x20exact-string\x20replacement\x20can\x20use\x20the\x20native\x20edit/patch\x20tool.\x20If\x20this\x20tool\x20errors\x20or\x20times\x20out,\x20fall\x20back\x20to\x20native\x20edit\x20with\x20exact\x20string\x20matching.\x0a\x0a','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','../package.json','grep\x20\x27','all','content','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','FileNotFound','boolean','path_validation_start','@morphllm/morphmcp\x20','tool_call_id','push','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','unknown\x20error','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','github_search_start','target_file','glob\x20\x27','linesAdded','completed','\x20error(s)','cwd','-\x20Glob\x20search\x20`'];a0_0x292b=function(){return _0x25c457;};return a0_0x292b();}function fixPathRepetition(_0x40d33b){const _0x158137=a0_0x3b4c,_0x167aa2=_0x40d33b[_0x158137(0x18b)](a0_0x5373b1[_0x158137(0x203)])[_0x158137(0x169)](Boolean);if(_0x167aa2['length']<0x2)return null;for(let _0x94e8aa=Math[_0x158137(0x173)](_0x167aa2[_0x158137(0x1d3)]/0x2);_0x94e8aa>=0x1;_0x94e8aa--){for(let _0x223c59=0x0;_0x223c59<=_0x167aa2[_0x158137(0x1d3)]-0x2*_0x94e8aa;_0x223c59++){const _0x410778=_0x167aa2[_0x158137(0x1ec)](_0x223c59,_0x223c59+_0x94e8aa),_0x46bb36=_0x167aa2[_0x158137(0x1ec)](_0x223c59+_0x94e8aa,_0x223c59+0x2*_0x94e8aa);if(_0x410778[_0x158137(0x243)]((_0x35410c,_0x51dabe)=>_0x35410c===_0x46bb36[_0x51dabe])){const _0x4c05d1=[..._0x167aa2[_0x158137(0x1ec)](0x0,_0x223c59),..._0x167aa2[_0x158137(0x1ec)](_0x223c59+_0x94e8aa)];return a0_0x5373b1[_0x158137(0x203)]+_0x4c05d1[_0x158137(0x204)](a0_0x5373b1['sep']);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x7a9c37=a0_0x3b4c;try{const _0x19bf7a=require(_0x7a9c37(0x1b1));return _0x19bf7a[_0x7a9c37(0x25b)]??'unknown';}catch(_0x36b3a9){return logMcpStderr(_0x7a9c37(0x1a3),_0x36b3a9),_0x7a9c37(0x22a);}}function printHelp(){const _0x5e8292=a0_0x3b4c;console[_0x5e8292(0x25a)](_0x5e8292(0x1b9)+getPackageVersion()),console[_0x5e8292(0x25a)](_0x5e8292(0x1f2)),console[_0x5e8292(0x25a)](_0x5e8292(0x288)),console['log'](_0x5e8292(0x27b)),console[_0x5e8292(0x25a)](_0x5e8292(0x217)),console['log']('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x5e8292(0x25a)](_0x5e8292(0x282)),console[_0x5e8292(0x25a)](_0x5e8292(0x249)),console[_0x5e8292(0x25a)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process['argv'][a0_0x2a3250(0x1ec)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x2a3250(0x171),'-h']);cliArgs['some'](_0x226aa0=>VERSION_FLAGS['has'](_0x226aa0))&&(console[a0_0x2a3250(0x25a)](a0_0x2a3250(0x1b9)+getPackageVersion()),process[a0_0x2a3250(0x174)](0x0));cliArgs[a0_0x2a3250(0x261)](_0x5e0a89=>HELP_FLAGS[a0_0x2a3250(0x251)](_0x5e0a89))&&(printHelp(),process[a0_0x2a3250(0x174)](0x0));function getCliArg(_0x1ec5f8){const _0x5d5b8d=a0_0x2a3250;for(let _0x4ad9d6=0x0;_0x4ad9d6<cliArgs[_0x5d5b8d(0x1d3)];_0x4ad9d6++){const _0x4110ee=cliArgs[_0x4ad9d6];if(_0x4110ee[_0x5d5b8d(0x28f)]('--'+_0x1ec5f8+'='))return _0x4110ee[_0x5d5b8d(0x1ec)](('--'+_0x1ec5f8+'=')[_0x5d5b8d(0x1d3)]);if(_0x4110ee==='--'+_0x1ec5f8&&_0x4ad9d6+0x1<cliArgs[_0x5d5b8d(0x1d3)])return cliArgs[_0x4ad9d6+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x2a3250(0x1d3)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x2a3250(0x251)](arg)||HELP_FLAGS[a0_0x2a3250(0x251)](arg))continue;if(arg[a0_0x2a3250(0x28f)](a0_0x2a3250(0x1a6)))continue;if(arg==='--api-key'){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process['env']['WORKSPACE_ROOT']||process['env'][a0_0x2a3250(0x175)]||process[a0_0x2a3250(0x1c5)](),ENABLE_WORKSPACE_MODE=process[a0_0x2a3250(0x1e8)][a0_0x2a3250(0x1d4)]!==a0_0x2a3250(0x1cb),MORPH_API_KEY=getCliArg(a0_0x2a3250(0x1aa))??process[a0_0x2a3250(0x1e8)]['MORPH_API_KEY'],MORPH_API_URL=process[a0_0x2a3250(0x1e8)][a0_0x2a3250(0x1c8)],MORPH_LARGE_APPLY=process[a0_0x2a3250(0x1e8)]['MORPH_LARGE_APPLY']!=='false',MORPH_WARP_GREP_TIMEOUT=process[a0_0x2a3250(0x1e8)][a0_0x2a3250(0x292)]?parseInt(process[a0_0x2a3250(0x1e8)][a0_0x2a3250(0x292)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x2a3250(0x1e8)][a0_0x2a3250(0x187)]?new Set(process['env'][a0_0x2a3250(0x187)][a0_0x2a3250(0x18b)](',')['map'](_0x469eb5=>_0x469eb5['trim']())['filter'](_0x2bfbb1=>_0x2bfbb1['length']>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x2a3250(0x1ae)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x2a3250(0x253)](a0_0x2a3250(0x192)+tool+'\x22.\x20Known\x20tools:\x20'+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console[a0_0x2a3250(0x253)](a0_0x2a3250(0x213)+[...DISABLED_TOOLS][a0_0x2a3250(0x204)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x2a3250(0x1c7))&&!MORPH_API_KEY[a0_0x2a3250(0x28f)]('morph-')&&logMcpStderr(a0_0x2a3250(0x1b0));async function reportMorphError(_0x38d631){const _0x41aac5=a0_0x2a3250;try{await a0_0x533768[_0x41aac5(0x28a)](_0x41aac5(0x1e4),{..._0x38d631,'timestamp':new Date()[_0x41aac5(0x16d)](),'source':_0x38d631[_0x41aac5(0x202)]||_0x41aac5(0x167),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x38d631['context']}},{'timeout':0x1388,'headers':{'Content-Type':_0x41aac5(0x285),'Authorization':_0x41aac5(0x1a1)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x23c9a7,_0x36d804){const _0x4a7743=a0_0x2a3250;if(_0x23c9a7&&typeof _0x23c9a7==='object'&&_0x4a7743(0x1d9)in _0x23c9a7)return _0x23c9a7[_0x4a7743(0x1d9)];if(_0x23c9a7&&typeof _0x23c9a7===_0x4a7743(0x277)&&_0x4a7743(0x19e)in _0x23c9a7)return _0x23c9a7[_0x4a7743(0x19e)]?.[_0x4a7743(0x1d9)];const _0x4251f1=_0x36d804[_0x4a7743(0x27e)](/\b(401|429)\b/);return _0x4251f1?parseInt(_0x4251f1[0x1],0xa):null;}function handleMorphAPIError(_0x17e063){const _0x2784eb=a0_0x2a3250,_0x2fc4cd=_0x17e063 instanceof Error?_0x17e063[_0x2784eb(0x22c)]:String(_0x17e063),_0x132c01=extractStatusCode(_0x17e063,_0x2fc4cd);switch(_0x132c01){case 0x191:return{'content':[{'type':_0x2784eb(0x1fa),'text':_0x2784eb(0x232)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x2784eb(0x1fa),'text':_0x2784eb(0x246)}],'isError':!![]};default:return null;}}args[a0_0x2a3250(0x1d3)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x2a3250(0x1bc)),logMcpStderr(a0_0x2a3250(0x19d)),logMcpStderr(a0_0x2a3250(0x1f5)),logMcpStderr(a0_0x2a3250(0x216)),logMcpStderr(a0_0x2a3250(0x252)),logMcpStderr(a0_0x2a3250(0x1da)));function normalizePath(_0xf5f9dd){return a0_0x5373b1['normalize'](_0xf5f9dd);}function expandHome(_0x466452){const _0xc77507=a0_0x2a3250;if(_0x466452[_0xc77507(0x28f)]('~/')||_0x466452==='~')return a0_0x5373b1[_0xc77507(0x204)](a0_0x43429b[_0xc77507(0x184)](),_0x466452[_0xc77507(0x1ec)](0x1));return _0x466452;}let allowedDirectories=await Promise[a0_0x2a3250(0x1b3)](args['map'](async _0x21bc2c=>{const _0x2a5a1d=a0_0x2a3250,_0x1a3b0e=expandHome(_0x21bc2c),_0x44ed7a=a0_0x5373b1[_0x2a5a1d(0x21c)](_0x1a3b0e);try{const _0x17c965=await a0_0x5e0960['realpath'](_0x44ed7a);return normalizePath(_0x17c965);}catch(_0x2bf26b){return normalizePath(_0x44ed7a);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+a0_0x2a3250(0x266)));}catch(a0_0x5a2e43){logMcpStderr(a0_0x2a3250(0x28b)+a0_0x5a2e43);}async function detectWorkspaceRoot(_0x4ff7f4){const _0x5e3a6f=a0_0x2a3250;let _0x880647=a0_0x5373b1[_0x5e3a6f(0x21c)](_0x4ff7f4);const _0x30a591=[_0x5e3a6f(0x272),_0x5e3a6f(0x212),_0x5e3a6f(0x26a),_0x5e3a6f(0x19f),_0x5e3a6f(0x20c),_0x5e3a6f(0x18c),'.cursor',_0x5e3a6f(0x24f),_0x5e3a6f(0x23d)];while(_0x880647!==a0_0x5373b1[_0x5e3a6f(0x16c)](_0x880647)){for(const _0x30ab5e of _0x30a591){const _0x14e7bc=a0_0x5373b1[_0x5e3a6f(0x204)](_0x880647,_0x30ab5e);try{return await a0_0x5e0960[_0x5e3a6f(0x205)](_0x14e7bc),normalizePath(_0x880647);}catch{}}_0x880647=a0_0x5373b1['dirname'](_0x880647);}return normalizePath(_0x4ff7f4);}await Promise[a0_0x2a3250(0x1b3)](args[a0_0x2a3250(0x1ff)](async _0x4e3c8f=>{const _0x328bec=a0_0x2a3250;try{const _0x7dc7a=await a0_0x5e0960[_0x328bec(0x220)](expandHome(_0x4e3c8f));!_0x7dc7a['isDirectory']()&&(logMcpStderr('Error:\x20'+_0x4e3c8f+_0x328bec(0x17b)),process[_0x328bec(0x174)](0x1));}catch(_0x36624b){logMcpStderr(_0x328bec(0x27d)+_0x4e3c8f+':',_0x36624b),process[_0x328bec(0x174)](0x1);}}));async function validatePath(_0x160c0f){const _0x19b7d6=a0_0x2a3250,_0x57b8c3=expandHome(_0x160c0f),_0x437fbf=a0_0x5373b1[_0x19b7d6(0x21c)](_0x57b8c3);logger[_0x19b7d6(0x18e)](_0x19b7d6(0x1ef),_0x19b7d6(0x1b8),{'raw_path':_0x160c0f,'absolute':_0x437fbf});try{const _0x497705=await a0_0x5e0960[_0x19b7d6(0x291)](_0x437fbf);return logger[_0x19b7d6(0x18e)](_0x19b7d6(0x1ef),_0x19b7d6(0x226),{'resolved':_0x497705,'symlink':_0x497705!==_0x437fbf}),_0x497705;}catch(_0x185d7e){if(_0x185d7e[_0x19b7d6(0x239)]===_0x19b7d6(0x25c)){const _0x318fc5=a0_0x5373b1[_0x19b7d6(0x16c)](_0x437fbf);try{const _0x1535b1=await a0_0x5e0960['realpath'](_0x318fc5),_0x37073b=a0_0x5373b1['join'](_0x1535b1,a0_0x5373b1['basename'](_0x437fbf));return logger[_0x19b7d6(0x18e)](_0x19b7d6(0x1ef),_0x19b7d6(0x226),{'resolved':_0x37073b,'new_file':!![]}),_0x37073b;}catch{logger['error']('MCP',_0x19b7d6(0x283),{'raw_path':_0x160c0f,'error':_0x19b7d6(0x1d2)+_0x318fc5});throw new Error(_0x19b7d6(0x1d2)+_0x318fc5);}}logger['error']('MCP',_0x19b7d6(0x283),{'raw_path':_0x160c0f,'error':_0x185d7e[_0x19b7d6(0x22c)]});throw _0x185d7e;}}const MorphEditFileArgsSchema=z[a0_0x2a3250(0x277)]({'path':z[a0_0x2a3250(0x178)](),'code_edit':z[a0_0x2a3250(0x178)]()['describe'](a0_0x2a3250(0x267)),'instruction':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x18f)](a0_0x2a3250(0x222)),'dryRun':z[a0_0x2a3250(0x1b7)]()[a0_0x2a3250(0x1e7)](![])[a0_0x2a3250(0x18f)](a0_0x2a3250(0x260))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x2a3250(0x179),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x18f)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x18f)](a0_0x2a3250(0x165)),'search_type':z['enum']([a0_0x2a3250(0x1e7),a0_0x2a3250(0x280)])[a0_0x2a3250(0x274)]()[a0_0x2a3250(0x18f)](a0_0x2a3250(0x207))}),WarpGrepGitHubArgsSchema=z[a0_0x2a3250(0x277)]({'search_string':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x274)]()[a0_0x2a3250(0x18f)]('GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'owner_repo':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x274)]()[a0_0x2a3250(0x18f)](a0_0x2a3250(0x24a)),'branch':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x274)]()[a0_0x2a3250(0x18f)](a0_0x2a3250(0x27a))}),CodebaseSearchArgsSchema=z[a0_0x2a3250(0x277)]({'query':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x18f)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()[a0_0x2a3250(0x18f)](a0_0x2a3250(0x275)),'branch':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x274)]()['describe']('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x274)]()[a0_0x2a3250(0x18f)](a0_0x2a3250(0x256)),'targetDirectories':z[a0_0x2a3250(0x27f)](z[a0_0x2a3250(0x178)]())[a0_0x2a3250(0x1e7)]([])[a0_0x2a3250(0x18f)](a0_0x2a3250(0x194)),'limit':z[a0_0x2a3250(0x1f7)]()[a0_0x2a3250(0x274)]()[a0_0x2a3250(0x1e7)](0xa)[a0_0x2a3250(0x18f)](a0_0x2a3250(0x195))}),server=new Server({'name':a0_0x2a3250(0x186),'version':a0_0x2a3250(0x235)},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x439013=a0_0x2a3250,_0x1ad444=[{'name':TOOL_NAMES['EDIT_FILE'],'description':_0x439013(0x17a)+_0x439013(0x1af)+_0x439013(0x1d7)+'-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a'+_0x439013(0x1e5)+_0x439013(0x20d)+_0x439013(0x1cc)+_0x439013(0x229)+_0x439013(0x248)+'Rules:\x0a'+_0x439013(0x218)+'-\x20Preserve\x20exact\x20indentation\x0a'+'-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a'+'-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES['CODEBASE_SEARCH'],'description':'A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20'+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x439013(0x1f4)+_0x439013(0x22b)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x321b29=_0x1ad444[_0x439013(0x169)](_0x58673f=>{const _0x4e1da7=_0x439013;if(DISABLED_TOOLS[_0x4e1da7(0x251)](_0x58673f['name']))return console[_0x4e1da7(0x253)]('Tool\x20'+_0x58673f[_0x4e1da7(0x21b)]+_0x4e1da7(0x1ad)),![];if('requiresApiKey'in _0x58673f&&_0x58673f[_0x4e1da7(0x223)]&&!MORPH_API_KEY)return logMcpStderr(_0x4e1da7(0x20a)+_0x58673f[_0x4e1da7(0x21b)]+_0x4e1da7(0x1f3)),![];return!![];});return{'tools':_0x321b29['map'](_0x164967=>({'name':_0x164967['name'],'description':_0x164967[_0x439013(0x1a7)],'inputSchema':_0x164967[_0x439013(0x25e)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x5cb12a=>{const _0x2bf1b8=a0_0x2a3250,{name:_0x3208b7,arguments:_0x4fb7d9}=_0x5cb12a[_0x2bf1b8(0x19a)],_0x4a2180=Date[_0x2bf1b8(0x21a)]();logger[_0x2bf1b8(0x18e)]('MCP',_0x2bf1b8(0x254),{'tool':_0x3208b7,'args':_0x3208b7==='edit_file'?{'path':_0x4fb7d9?.[_0x2bf1b8(0x271)],'instruction':_0x4fb7d9?.[_0x2bf1b8(0x258)]||_0x4fb7d9?.[_0x2bf1b8(0x233)],'dryRun':_0x4fb7d9?.[_0x2bf1b8(0x276)]}:_0x4fb7d9});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x2bf1b8(0x1fa),'text':'No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.'}],'isError':!![]};if(!MORPH_API_KEY[_0x2bf1b8(0x28f)](_0x2bf1b8(0x1c7))&&!MORPH_API_KEY['startsWith']('morph-'))return{'content':[{'type':_0x2bf1b8(0x1fa),'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[_0x2bf1b8(0x251)](_0x3208b7))return{'content':[{'type':'text','text':_0x2bf1b8(0x177)+_0x3208b7+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x3208b7){case TOOL_NAMES[_0x2bf1b8(0x23e)]:{let _0x9a4886=_0x4fb7d9;if(_0x9a4886&&typeof _0x9a4886===_0x2bf1b8(0x277)){if(!(_0x2bf1b8(0x271)in _0x9a4886)){const _0x17966c=_0x9a4886[_0x2bf1b8(0x1c0)]??_0x9a4886[_0x2bf1b8(0x268)]??_0x9a4886[_0x2bf1b8(0x201)]??_0x9a4886['file_path']??_0x9a4886[_0x2bf1b8(0x221)];if(_0x17966c)_0x9a4886={..._0x9a4886,'path':_0x17966c};}_0x2bf1b8(0x233)in _0x9a4886&&!(_0x2bf1b8(0x258)in _0x9a4886)&&(_0x9a4886={..._0x9a4886,'instruction':_0x9a4886['instructions']});if(!(_0x2bf1b8(0x1f1)in _0x9a4886)){const _0x5edcd0=_0x9a4886[_0x2bf1b8(0x239)]??_0x9a4886[_0x2bf1b8(0x28e)]??_0x9a4886[_0x2bf1b8(0x1b4)]??_0x9a4886[_0x2bf1b8(0x250)];if(_0x5edcd0)_0x9a4886={..._0x9a4886,'code_edit':_0x5edcd0};}}const _0x1531e5=MorphEditFileArgsSchema[_0x2bf1b8(0x1ea)](_0x9a4886);if(!_0x1531e5['success'])throw new Error(_0x2bf1b8(0x1b5)+_0x1531e5[_0x2bf1b8(0x253)]);const _0x21adee=await validatePath(_0x1531e5[_0x2bf1b8(0x262)]['path']);let _0x4f023f=null,_0x17f74e=!![],_0x2990a7=null;try{_0x4f023f=await a0_0x5e0960['readFile'](_0x21adee,_0x2bf1b8(0x19b)),logger[_0x2bf1b8(0x18e)]('MCP','file_read_complete',{'path':_0x21adee,'size_bytes':_0x4f023f[_0x2bf1b8(0x1d3)]});}catch(_0x2fd173){const _0x38e345=_0x2fd173[_0x2bf1b8(0x239)];_0x38e345===_0x2bf1b8(0x25c)?(_0x17f74e=![],_0x4f023f='',logger[_0x2bf1b8(0x18e)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x28d),{'path':_0x21adee,'exists':![]})):(_0x2990a7=_0x2bf1b8(0x290)+(_0x38e345||'unknown')+_0x2bf1b8(0x197)+(_0x2fd173 instanceof Error?_0x2fd173[_0x2bf1b8(0x22c)]:String(_0x2fd173)),logger[_0x2bf1b8(0x253)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x1db),{'path':_0x21adee,'error':_0x2990a7}),logMcpStderr('Warning:\x20'+_0x2990a7));}let _0x2cf959;try{const _0x5367e3=MORPH_API_KEY;if(!_0x5367e3)throw new Error(_0x2bf1b8(0x206));const _0x55768a=a0_0x5373b1['dirname'](_0x21adee),_0x29b140=a0_0x5373b1[_0x2bf1b8(0x1dc)](_0x21adee);logger[_0x2bf1b8(0x18e)](_0x2bf1b8(0x1ef),'api_request_start',{'model':_0x2bf1b8(0x230),'path':_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x271)],'instruction_len':_0x1531e5['data'][_0x2bf1b8(0x258)][_0x2bf1b8(0x1d3)],'code_edit_len':_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x1f1)][_0x2bf1b8(0x1d3)],'original_code_len':_0x4f023f?.[_0x2bf1b8(0x1d3)]??0x0,'dry_run':_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x276)]});const _0x160914=Date[_0x2bf1b8(0x21a)](),_0x3ffb8c=await executeEditFile({'target_filepath':_0x29b140,'code_edit':_0x1531e5['data'][_0x2bf1b8(0x1f1)],'instruction':_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x258)]},{'morphApiKey':_0x5367e3,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x55768a,'autoWrite':!_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x276)],'generateUdiff':![],'debug':![]}),_0x5873ec=Date[_0x2bf1b8(0x21a)]()-_0x160914;_0x2cf959=_0x3ffb8c[_0x2bf1b8(0x244)];if(!_0x3ffb8c[_0x2bf1b8(0x1a8)])throw new Error(_0x3ffb8c['error']||_0x2bf1b8(0x208));const _0x3ccbc8=_0x3ffb8c[_0x2bf1b8(0x176)],_0x34c5ee=_0x2bf1b8(0x1df)+_0x3ccbc8[_0x2bf1b8(0x1c2)]+',\x20removed\x20'+_0x3ccbc8['linesRemoved']+',\x20modified\x20'+_0x3ccbc8[_0x2bf1b8(0x17e)];logger['debug']('MCP',_0x2bf1b8(0x1e6),{'tool':'edit_file','success':!![],'latency_ms':Date[_0x2bf1b8(0x21a)]()-_0x4a2180,'edit_latency_ms':_0x5873ec,'changes':{'added':_0x3ccbc8[_0x2bf1b8(0x1c2)],'removed':_0x3ccbc8[_0x2bf1b8(0x26e)],'modified':_0x3ccbc8['linesModified']},'completion_id':_0x2cf959});if(_0x1531e5[_0x2bf1b8(0x262)]['dryRun'])return{'content':[{'type':'text','text':_0x2bf1b8(0x259)+(_0x17f74e?'':'\x20(new\x20file)')+':\x20'+_0x1531e5['data'][_0x2bf1b8(0x258)]+_0x2bf1b8(0x22e)+_0x34c5ee+_0x2bf1b8(0x1a9)+_0x1531e5[_0x2bf1b8(0x262)]['path']+'.'}]};return{'content':[{'type':_0x2bf1b8(0x1fa),'text':_0x2bf1b8(0x209)+(_0x17f74e?_0x2bf1b8(0x1e2):_0x2bf1b8(0x265))+':\x20'+_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x258)]+'.\x20Changes:\x20'+_0x34c5ee+_0x2bf1b8(0x1a9)+_0x1531e5['data'][_0x2bf1b8(0x271)]+'.'}]};}catch(_0x5bea91){const _0x160eef=handleMorphAPIError(_0x5bea91);if(_0x160eef)return logger[_0x2bf1b8(0x253)]('MCP','tool_call_error',{'tool':_0x2bf1b8(0x168),'error':_0x2bf1b8(0x193),'latency_ms':Date[_0x2bf1b8(0x21a)]()-_0x4a2180}),_0x160eef;const _0x18416d=_0x5bea91 instanceof Error?_0x5bea91['message']:String(_0x5bea91);return logger[_0x2bf1b8(0x253)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x1f6),{'tool':'edit_file','error':_0x18416d,'path':_0x1531e5['data'][_0x2bf1b8(0x271)],'validated_path':_0x21adee,'latency_ms':Date[_0x2bf1b8(0x21a)]()-_0x4a2180,'stack':_0x5bea91 instanceof Error?_0x5bea91[_0x2bf1b8(0x1e9)]:undefined}),reportMorphError({'error_message':_0x18416d,'error_type':_0x5bea91 instanceof Error?_0x5bea91[_0x2bf1b8(0x210)][_0x2bf1b8(0x21b)]:_0x2bf1b8(0x237),'context':{'tool':_0x2bf1b8(0x168),'completion_id':_0x2cf959,'file_path':_0x1531e5[_0x2bf1b8(0x262)]['path'],'validated_path':_0x21adee,'instruction':_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x258)],'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x2bf1b8(0x230),'dry_run':_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x276)],'file_exists':_0x17f74e,'file_read_error':_0x2990a7,'file_readable':_0x4f023f!==null,'request_content':{'path':_0x1531e5['data']['path'],'code_edit':_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x1f1)],'instruction':_0x1531e5[_0x2bf1b8(0x262)]['instruction'],'original_code':_0x4f023f!==null?_0x4f023f[_0x2bf1b8(0x1d3)]>0xc350?_0x4f023f[_0x2bf1b8(0x240)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x4f023f[_0x2bf1b8(0x1d3)]+_0x2bf1b8(0x287):_0x4f023f:_0x2bf1b8(0x1a0)+(_0x2990a7||_0x2bf1b8(0x1bd))+']','original_code_length':_0x4f023f?.[_0x2bf1b8(0x1d3)]??0x0,'model':MORPH_LARGE_APPLY?_0x2bf1b8(0x18a):_0x2bf1b8(0x230),'dry_run':_0x1531e5['data'][_0x2bf1b8(0x276)]}},'stack_trace':_0x5bea91 instanceof Error?_0x5bea91[_0x2bf1b8(0x1e9)]:undefined,'source':_0x2bf1b8(0x167)})[_0x2bf1b8(0x181)](()=>{}),{'content':[{'type':_0x2bf1b8(0x1fa),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x18416d}],'isError':!![]};}}case TOOL_NAMES[_0x2bf1b8(0x1a2)]:{const _0x1efd85=WarpGrepArgsSchema[_0x2bf1b8(0x1ea)](_0x4fb7d9);if(!_0x1efd85[_0x2bf1b8(0x1a8)])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x1efd85[_0x2bf1b8(0x253)]}],'isError':!![]};const _0x10e56f=_0x5e6bfb=>{const _0x1d7c58=_0x2bf1b8,_0x2ebdc7=[];for(const _0x27be34 of _0x5e6bfb||[]){if(_0x27be34[_0x1d7c58(0x236)]==='assistant'&&Array[_0x1d7c58(0x20b)](_0x27be34[_0x1d7c58(0x1de)]))for(const _0x2eb91a of _0x27be34[_0x1d7c58(0x1de)]){try{const _0x4af098=_0x2eb91a[_0x1d7c58(0x1ac)]?.[_0x1d7c58(0x21b)],_0xbb19b1=JSON[_0x1d7c58(0x284)](_0x2eb91a[_0x1d7c58(0x1ac)]?.[_0x1d7c58(0x26b)]||'{}');if(_0x4af098===_0x1d7c58(0x24c))_0x2ebdc7[_0x1d7c58(0x1bb)](_0x1d7c58(0x1b2)+_0xbb19b1[_0x1d7c58(0x17f)]+'\x27\x20'+(_0xbb19b1[_0x1d7c58(0x271)]||'.'));else{if(_0x4af098===_0x1d7c58(0x166))_0x2ebdc7['push'](_0x1d7c58(0x279)+_0xbb19b1[_0x1d7c58(0x271)]);else{if(_0x4af098===_0x1d7c58(0x247))_0x2ebdc7[_0x1d7c58(0x1bb)]('list_directory\x20'+(_0xbb19b1['command']||'.'));else{if(_0x4af098==='glob')_0x2ebdc7[_0x1d7c58(0x1bb)](_0x1d7c58(0x1c1)+_0xbb19b1[_0x1d7c58(0x17f)]+'\x27\x20'+(_0xbb19b1[_0x1d7c58(0x271)]||'.'));else _0x4af098===_0x1d7c58(0x1cd)&&_0x2ebdc7[_0x1d7c58(0x1bb)](_0x1d7c58(0x1cd));}}}}catch{}}}return _0x2ebdc7;},_0x2b29be=_0x5db2df=>{const _0x5e32ba=_0x2bf1b8,_0x48a1a8=[];if(!_0x5db2df||!Array[_0x5e32ba(0x20b)](_0x5db2df))return _0x48a1a8;const _0x5c1a3b=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x5e32ba(0x1b6),'tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':_0x5e32ba(0x1ed),'tool':_0x5e32ba(0x166)},{'pattern':/\[READ ERROR\]/,'error_type':_0x5e32ba(0x17c),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x5e32ba(0x1e1),'tool':_0x5e32ba(0x166)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x5e32ba(0x26d),'tool':_0x5e32ba(0x19c)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':'RipgrepNotAvailable','tool':_0x5e32ba(0x19c)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x5e32ba(0x1e1),'tool':_0x5e32ba(0x166)},{'pattern':/\[SYMLINK\]/,'error_type':_0x5e32ba(0x1d6),'tool':_0x5e32ba(0x166)},{'pattern':/not a text file/,'error_type':_0x5e32ba(0x1e1),'tool':_0x5e32ba(0x166)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x5e32ba(0x166)},{'pattern':/Error reading file:/,'error_type':_0x5e32ba(0x17c),'tool':'read'},{'pattern':/status="error"/,'error_type':_0x5e32ba(0x198),'tool':'unknown'}];let _0x2a7e9c=0x0;for(const _0x192625 of _0x5db2df){_0x192625['role']==='assistant'&&Array['isArray'](_0x192625[_0x5e32ba(0x1de)])&&_0x2a7e9c++;const _0x3d0689=_0x192625['content'];if((_0x192625[_0x5e32ba(0x236)]==='tool'||_0x192625[_0x5e32ba(0x236)]===_0x5e32ba(0x189))&&_0x3d0689&&typeof _0x3d0689===_0x5e32ba(0x178))for(const {pattern:_0x725cbc,error_type:_0x3ad4cd,tool:_0x5a9da5}of _0x5c1a3b){const _0x50248f=_0x3d0689[_0x5e32ba(0x27e)](new RegExp(_0x725cbc[_0x5e32ba(0x202)],'g'));if(_0x50248f)for(const _0x46309d of _0x50248f){const _0x15f9b2=_0x3d0689[_0x5e32ba(0x1f0)](_0x46309d),_0x3e04af=_0x3d0689[_0x5e32ba(0x240)](_0x15f9b2,Math['min'](_0x15f9b2+0xc8,_0x3d0689[_0x5e32ba(0x1d3)]));_0x48a1a8[_0x5e32ba(0x1bb)]({'tool':_0x5a9da5,'error_type':_0x3ad4cd,'error_message':_0x3e04af[_0x5e32ba(0x18b)]('\x0a')[0x0],'turn':_0x2a7e9c});}}}return _0x48a1a8;};try{const _0x4ffaf3=a0_0x5373b1[_0x2bf1b8(0x21c)](_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ee)]),_0x170448=_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x263)],_0x56d277=_0x170448===_0x2bf1b8(0x280)?{'allowNames':[_0x2bf1b8(0x280)]}:undefined,_0x1e1044=new LocalRipgrepProvider(_0x4ffaf3,undefined,_0x56d277);logger[_0x2bf1b8(0x18e)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x25d),{'type':_0x2bf1b8(0x170),'repo_root':_0x4ffaf3,'search_type':_0x170448||_0x2bf1b8(0x1e7)}),logger[_0x2bf1b8(0x18e)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x270),{'query':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'repo_root':_0x4ffaf3,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x5f38f9=Date[_0x2bf1b8(0x21a)](),_0x16c16a=await runWarpGrep({'searchTerm':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'repoRoot':_0x4ffaf3,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x1e1044,'search_type':_0x170448}),_0x451726=Date[_0x2bf1b8(0x21a)]()-_0x5f38f9,_0x454b3f=_0x16c16a['finish']?.[_0x2bf1b8(0x255)]?.[_0x2bf1b8(0x1d8)]?.[_0x2bf1b8(0x1d3)]??0x0;logger[_0x2bf1b8(0x18e)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x188),{'termination':_0x16c16a[_0x2bf1b8(0x242)],'turns':_0x16c16a[_0x2bf1b8(0x182)]?.[_0x2bf1b8(0x172)]??0x0,'files_found':_0x454b3f,'latency_ms':_0x451726});const _0x4e9933=_0x2b29be(_0x16c16a[_0x2bf1b8(0x25f)]);_0x4e9933['length']>0x0&&reportMorphError({'error_message':_0x2bf1b8(0x286)+_0x4e9933['length']+_0x2bf1b8(0x1c4),'error_type':_0x2bf1b8(0x214),'level':'warn','tool':_0x2bf1b8(0x281),'context':{'repo_path':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ee)],'query':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'model':_0x2bf1b8(0x21f),'termination_reason':_0x16c16a['terminationReason'],'sub_tool_errors':_0x4e9933,'timings':_0x16c16a[_0x2bf1b8(0x182)],'tool_calls':_0x10e56f(_0x16c16a[_0x2bf1b8(0x25f)]),'messages':_0x16c16a[_0x2bf1b8(0x25f)]?.['map'](_0x36c6b5=>({'role':_0x36c6b5['role'],'content':_0x36c6b5[_0x2bf1b8(0x1b4)],..._0x36c6b5['tool_calls']?{'tool_calls':_0x36c6b5['tool_calls'][_0x2bf1b8(0x1d3)]}:{},..._0x36c6b5[_0x2bf1b8(0x1ba)]?{'tool_call_id':_0x36c6b5[_0x2bf1b8(0x1ba)]}:{}}))},'source':'mcp-filesystem'})[_0x2bf1b8(0x181)](()=>{});let _0xf95e62='';if(_0x16c16a[_0x2bf1b8(0x242)]===_0x2bf1b8(0x1c3)&&_0x16c16a[_0x2bf1b8(0x1cd)]?.['metadata']?.['files']){const _0x4e963e=_0x16c16a[_0x2bf1b8(0x1cd)][_0x2bf1b8(0x255)][_0x2bf1b8(0x1d8)];if(_0x4e963e['length']===0x0)return _0xf95e62=_0x16c16a[_0x2bf1b8(0x1cd)][_0x2bf1b8(0x238)]||_0x2bf1b8(0x28c),{'content':[{'type':_0x2bf1b8(0x1fa),'text':_0xf95e62}]};const _0x5f599d=[],_0x22ff45=[_0x2bf1b8(0x1be)];for(const _0x29b6ac of _0x16c16a[_0x2bf1b8(0x25f)]){if(_0x29b6ac[_0x2bf1b8(0x236)]===_0x2bf1b8(0x180)&&Array[_0x2bf1b8(0x20b)](_0x29b6ac['tool_calls']))for(const _0x5e9191 of _0x29b6ac[_0x2bf1b8(0x1de)]){try{const _0x38f0d8=_0x5e9191['function']?.['name'],_0x330c7d=JSON['parse'](_0x5e9191[_0x2bf1b8(0x1ac)]?.[_0x2bf1b8(0x26b)]||'{}');if(_0x38f0d8==='grep_search')_0x22ff45[_0x2bf1b8(0x1bb)](_0x2bf1b8(0x1c9)+_0x330c7d[_0x2bf1b8(0x17f)]+'\x27\x20in\x20`'+(_0x330c7d[_0x2bf1b8(0x271)]||'.')+'`');else{if(_0x38f0d8===_0x2bf1b8(0x166))_0x22ff45[_0x2bf1b8(0x1bb)](_0x2bf1b8(0x1fc)+_0x330c7d[_0x2bf1b8(0x271)]+'`');else{if(_0x38f0d8===_0x2bf1b8(0x247))_0x22ff45[_0x2bf1b8(0x1bb)](_0x2bf1b8(0x1d0)+(_0x330c7d[_0x2bf1b8(0x215)]||'.')+'`');else _0x38f0d8===_0x2bf1b8(0x224)&&_0x22ff45[_0x2bf1b8(0x1bb)](_0x2bf1b8(0x1c6)+_0x330c7d[_0x2bf1b8(0x17f)]+_0x2bf1b8(0x1eb)+(_0x330c7d['path']||'.')+'`');}}}catch{}}}_0x5f599d[_0x2bf1b8(0x1bb)](_0x22ff45[_0x2bf1b8(0x204)]('\x0a'));const _0x16bf28=['','Relevant\x20context\x20found:'];for(const _0x51f4fd of _0x4e963e){if(_0x51f4fd[_0x2bf1b8(0x20f)]==='*')_0x16bf28[_0x2bf1b8(0x1bb)]('-\x20'+_0x51f4fd[_0x2bf1b8(0x271)]+':*');else{if(Array[_0x2bf1b8(0x20b)](_0x51f4fd[_0x2bf1b8(0x20f)])){const _0x7d5759=_0x51f4fd[_0x2bf1b8(0x20f)]['map'](([_0x4a13a6,_0x1251dc])=>{if(_0x4a13a6===_0x1251dc)return''+_0x4a13a6;return _0x4a13a6+'-'+_0x1251dc;});_0x16bf28['push']('-\x20'+_0x51f4fd[_0x2bf1b8(0x271)]+':'+_0x7d5759[_0x2bf1b8(0x204)](','));}else _0x16bf28[_0x2bf1b8(0x1bb)]('-\x20'+_0x51f4fd['path']+':*');}}_0x16bf28[_0x2bf1b8(0x1bb)](''),_0x5f599d[_0x2bf1b8(0x1bb)](_0x16bf28[_0x2bf1b8(0x204)]('\x0a')),_0x5f599d[_0x2bf1b8(0x1bb)](_0x2bf1b8(0x185));const _0x5cccce=[],_0x86d90d=[];for(const _0x437b66 of _0x4e963e){let _0x1f7677=a0_0x5373b1['resolve'](_0x1efd85[_0x2bf1b8(0x262)]['repo_path'],_0x437b66[_0x2bf1b8(0x271)]),_0x6043e2=null,_0x533010=null;try{_0x6043e2=await a0_0x5e0960[_0x2bf1b8(0x200)](_0x1f7677,{'encoding':_0x2bf1b8(0x19b)});}catch(_0x34c85d){const _0x51f6b0=fixPathRepetition(_0x1f7677);if(_0x51f6b0)try{_0x6043e2=await a0_0x5e0960[_0x2bf1b8(0x200)](_0x51f6b0,{'encoding':_0x2bf1b8(0x19b)}),_0x1f7677=_0x51f6b0;}catch{_0x533010=_0x34c85d instanceof Error?_0x34c85d:new Error(String(_0x34c85d));}else _0x533010=_0x34c85d instanceof Error?_0x34c85d:new Error(String(_0x34c85d));}if(_0x6043e2!==null){const _0x5049af=_0x6043e2['split'](/\r?\n/),_0x5cbe35=[];if(_0x437b66[_0x2bf1b8(0x20f)]==='*'||!Array[_0x2bf1b8(0x20b)](_0x437b66['lines']))for(let _0xede4e5=0x1;_0xede4e5<=_0x5049af[_0x2bf1b8(0x1d3)];_0xede4e5++){const _0x5c4b1c=_0x5049af[_0xede4e5-0x1];_0x5cbe35[_0x2bf1b8(0x1bb)](_0xede4e5+'|\x20'+_0x5c4b1c);}else for(const [_0x4fb071,_0x2b2e76]of _0x437b66[_0x2bf1b8(0x20f)]){_0x5cbe35[_0x2bf1b8(0x1d3)]>0x0&&_0x5cbe35['push']('');for(let _0x186122=_0x4fb071;_0x186122<=_0x2b2e76&&_0x186122<=_0x5049af['length'];_0x186122++){const _0x5517c8=_0x5049af[_0x186122-0x1];_0x5cbe35['push'](_0x186122+'|\x20'+_0x5517c8);}}_0x86d90d[_0x2bf1b8(0x1bb)]({'path':_0x437b66[_0x2bf1b8(0x271)],'content':_0x5cbe35['join']('\x0a')});}else _0x5cccce[_0x2bf1b8(0x1bb)](_0x2bf1b8(0x231)+_0x437b66[_0x2bf1b8(0x271)]+_0x2bf1b8(0x199)+(_0x533010?.[_0x2bf1b8(0x22c)]||_0x2bf1b8(0x227))+'\x0a</file>');}try{const _0xf9ce4b=await compactFileContexts(_0x86d90d,_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],MORPH_API_KEY,MORPH_API_URL);for(const _0x57930b of _0xf9ce4b){_0x5cccce[_0x2bf1b8(0x1bb)](_0x2bf1b8(0x231)+_0x57930b[_0x2bf1b8(0x271)]+_0x2bf1b8(0x1fe)+_0x57930b[_0x2bf1b8(0x1b4)]+'\x0a</file>');}}catch(_0x2508b1){logger[_0x2bf1b8(0x20e)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x26c),{'error':_0x2508b1 instanceof Error?_0x2508b1[_0x2bf1b8(0x22c)]:String(_0x2508b1),'files_count':_0x86d90d['length']});for(const _0x4fa556 of _0x86d90d){_0x5cccce[_0x2bf1b8(0x1bb)]('<file\x20path=\x22'+_0x4fa556['path']+'\x22>\x0a'+_0x4fa556['content']+_0x2bf1b8(0x16b));}}_0x5f599d[_0x2bf1b8(0x1bb)](_0x5cccce[_0x2bf1b8(0x204)]('\x0a\x0a')),_0xf95e62=_0x5f599d[_0x2bf1b8(0x204)]('\x0a');const _0x3a4006=_0x16c16a[_0x2bf1b8(0x1fd)]?.[_0x2bf1b8(0x169)](_0x50d1aa=>_0x50d1aa[_0x2bf1b8(0x22c)]?.[_0x2bf1b8(0x28f)](_0x2bf1b8(0x1ca)))||[];if(_0x3a4006['length']>0x0){const _0x22e635=_0x3a4006[_0x2bf1b8(0x1ff)](_0x53b41f=>_0x53b41f['message'])['join'](';\x20');reportMorphError({'error_message':_0x22e635,'error_type':'FileReadError','context':{'tool':_0x2bf1b8(0x281),'repo_path':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ee)],'query':_0x1efd85[_0x2bf1b8(0x262)]['search_string'],'model':_0x2bf1b8(0x21f),'termination_reason':'completed_with_file_errors','error_count':_0x3a4006[_0x2bf1b8(0x1d3)],'is_timeout':![],'timings':_0x16c16a[_0x2bf1b8(0x182)],'files_attempted':_0x4e963e[_0x2bf1b8(0x1ff)](_0xdd245c=>({'path':_0xdd245c[_0x2bf1b8(0x271)],'lines':_0xdd245c['lines']})),'tool_calls':_0x10e56f(_0x16c16a[_0x2bf1b8(0x25f)]),'messages':_0x16c16a[_0x2bf1b8(0x25f)]?.['map'](_0x4da5cd=>({'role':_0x4da5cd['role'],'content':_0x4da5cd[_0x2bf1b8(0x1b4)],..._0x4da5cd['tool_calls']?{'tool_calls':_0x4da5cd[_0x2bf1b8(0x1de)][_0x2bf1b8(0x1d3)]}:{},..._0x4da5cd[_0x2bf1b8(0x1ba)]?{'tool_call_id':_0x4da5cd[_0x2bf1b8(0x1ba)]}:{}})),'request_content':{'query':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'repo_path':_0x1efd85['data'][_0x2bf1b8(0x1ee)],'repoRoot':a0_0x5373b1['resolve'](_0x1efd85['data'][_0x2bf1b8(0x1ee)]),'model':'morph-warp-grep-v2.1'}},'source':_0x2bf1b8(0x167)})[_0x2bf1b8(0x181)](()=>{});}}else{if(_0x16c16a[_0x2bf1b8(0x242)]==='terminated'&&_0x16c16a[_0x2bf1b8(0x1fd)][_0x2bf1b8(0x1d3)]>0x0){const _0x4eac79=_0x16c16a['errors'][_0x2bf1b8(0x1ff)](_0x649925=>_0x649925[_0x2bf1b8(0x22c)])[_0x2bf1b8(0x204)](';\x20');_0xf95e62=_0x2bf1b8(0x22d)+_0x4eac79;const _0x288fa6=_0x4eac79[_0x2bf1b8(0x234)]()[_0x2bf1b8(0x23f)](_0x2bf1b8(0x1e0))||_0x4eac79[_0x2bf1b8(0x234)]()['includes']('timed\x20out')||_0x4eac79[_0x2bf1b8(0x234)]()[_0x2bf1b8(0x23f)](_0x2bf1b8(0x16f)),_0x571e90=_0x16c16a[_0x2bf1b8(0x1cd)]?.[_0x2bf1b8(0x255)]?.[_0x2bf1b8(0x1d8)],_0xf5c9a6=_0x16c16a['errors'][0x0];reportMorphError({'error_message':_0x4eac79,'error_type':_0x288fa6?_0x2bf1b8(0x257):_0xf5c9a6?.[_0x2bf1b8(0x210)]?.[_0x2bf1b8(0x21b)]||_0x2bf1b8(0x1f8),'context':{'tool':'codebase_search','repo_path':_0x1efd85[_0x2bf1b8(0x262)]['repo_path'],'query':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'model':_0x2bf1b8(0x21f),'termination_reason':_0x16c16a[_0x2bf1b8(0x242)],'error_count':_0x16c16a[_0x2bf1b8(0x1fd)]['length'],'is_timeout':_0x288fa6,'timings':_0x16c16a[_0x2bf1b8(0x182)],'files_attempted':_0x571e90?.[_0x2bf1b8(0x1ff)](_0x221d36=>({'path':_0x221d36[_0x2bf1b8(0x271)],'lines':_0x221d36[_0x2bf1b8(0x20f)]})),'tool_calls':_0x10e56f(_0x16c16a[_0x2bf1b8(0x25f)]),'messages':_0x16c16a[_0x2bf1b8(0x25f)]?.['map'](_0x100fa1=>({'role':_0x100fa1['role'],'content':_0x100fa1[_0x2bf1b8(0x1b4)],..._0x100fa1[_0x2bf1b8(0x1de)]?{'tool_calls':_0x100fa1[_0x2bf1b8(0x1de)]['length']}:{},..._0x100fa1[_0x2bf1b8(0x1ba)]?{'tool_call_id':_0x100fa1[_0x2bf1b8(0x1ba)]}:{}})),'request_content':{'query':_0x1efd85['data'][_0x2bf1b8(0x228)],'repo_path':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ee)],'repoRoot':a0_0x5373b1[_0x2bf1b8(0x21c)](_0x1efd85[_0x2bf1b8(0x262)]['repo_path']),'model':_0x2bf1b8(0x21f)}},'stack_trace':_0xf5c9a6?.['stack']||undefined,'source':'mcp-filesystem'})['catch'](()=>{});}else _0xf95e62=_0x2bf1b8(0x289);}return{'content':[{'type':'text','text':_0xf95e62}]};}catch(_0x24fd81){const _0x405a37=handleMorphAPIError(_0x24fd81);if(_0x405a37)return logger[_0x2bf1b8(0x253)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x1f6),{'tool':_0x2bf1b8(0x281),'error':_0x2bf1b8(0x193),'latency_ms':Date[_0x2bf1b8(0x21a)]()-_0x4a2180}),_0x405a37;const _0x4c8e76=_0x24fd81 instanceof Error?_0x24fd81[_0x2bf1b8(0x22c)]:String(_0x24fd81);logger[_0x2bf1b8(0x253)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x1f6),{'tool':_0x2bf1b8(0x281),'error':_0x4c8e76,'repo_path':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ee)],'query':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'latency_ms':Date[_0x2bf1b8(0x21a)]()-_0x4a2180});const _0x3c7016=_0x4c8e76[_0x2bf1b8(0x234)]()[_0x2bf1b8(0x23f)](_0x2bf1b8(0x1e0))||_0x4c8e76[_0x2bf1b8(0x234)]()['includes']('timed\x20out')||_0x4c8e76[_0x2bf1b8(0x234)]()[_0x2bf1b8(0x23f)](_0x2bf1b8(0x16f))||_0x24fd81 instanceof Error&&_0x24fd81[_0x2bf1b8(0x21b)]===_0x2bf1b8(0x257);return reportMorphError({'error_message':_0x4c8e76,'error_type':_0x3c7016?_0x2bf1b8(0x257):_0x24fd81 instanceof Error?_0x24fd81['constructor'][_0x2bf1b8(0x21b)]:_0x2bf1b8(0x237),'context':{'tool':_0x2bf1b8(0x281),'repo_path':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ee)],'query':_0x1efd85['data'][_0x2bf1b8(0x228)],'model':_0x2bf1b8(0x21f),'is_timeout':_0x3c7016,'exception_phase':_0x2bf1b8(0x17d),'request_content':{'query':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'repo_path':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ee)],'repoRoot':a0_0x5373b1[_0x2bf1b8(0x21c)](_0x1efd85['data'][_0x2bf1b8(0x1ee)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x24fd81 instanceof Error?_0x24fd81[_0x2bf1b8(0x1e9)]:undefined,'source':_0x2bf1b8(0x167)})[_0x2bf1b8(0x181)](()=>{}),{'content':[{'type':_0x2bf1b8(0x1fa),'text':_0x2bf1b8(0x21e)+_0x4c8e76}],'isError':![]};}}case TOOL_NAMES[_0x2bf1b8(0x269)]:{const _0x3f7e8a=WarpGrepGitHubArgsSchema[_0x2bf1b8(0x1ea)](_0x4fb7d9);if(!_0x3f7e8a['success'])return{'content':[{'type':_0x2bf1b8(0x1fa),'text':'Invalid\x20arguments:\x20'+_0x3f7e8a[_0x2bf1b8(0x253)]}],'isError':!![]};const _0x3499be=_0x3f7e8a[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ce)]||_0x3f7e8a[_0x2bf1b8(0x262)]['owner_repo'];if(!_0x3499be)return{'content':[{'type':'text','text':_0x2bf1b8(0x24b)}],'isError':!![]};const _0x11b3de=MORPH_API_KEY;if(!_0x11b3de)throw new Error(_0x2bf1b8(0x206));const _0x173aeb=Date[_0x2bf1b8(0x21a)]();logger[_0x2bf1b8(0x18e)]('MCP',_0x2bf1b8(0x1bf),{'identifier':_0x3499be,'query':_0x3f7e8a['data'][_0x2bf1b8(0x228)],'branch':_0x3f7e8a[_0x2bf1b8(0x262)][_0x2bf1b8(0x225)]});try{const _0x3688f9=new WarpGrepClient({'morphApiKey':_0x11b3de,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x5e1ac1=await _0x3688f9[_0x2bf1b8(0x241)]({'searchTerm':_0x3f7e8a[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'github':_0x3499be,'branch':_0x3f7e8a[_0x2bf1b8(0x262)][_0x2bf1b8(0x225)]}),_0x4cef6f=Date[_0x2bf1b8(0x21a)]()-_0x173aeb;logMcpStderr(_0x2bf1b8(0x1dd)+_0x4cef6f+'ms.\x20Success:\x20'+_0x5e1ac1[_0x2bf1b8(0x1a8)]);const _0x3a9397=formatResult(_0x5e1ac1);return{'content':[{'type':_0x2bf1b8(0x1fa),'text':_0x3a9397}]};}catch(_0xde95c2){const _0x3780fc=handleMorphAPIError(_0xde95c2);if(_0x3780fc)return _0x3780fc;const _0x4f5f35=Date[_0x2bf1b8(0x21a)]()-_0x173aeb,_0xefd03a=_0xde95c2 instanceof Error?_0xde95c2[_0x2bf1b8(0x22c)]:String(_0xde95c2);return logMcpStderr('[github_codebase_search]\x20Failed\x20in\x20'+_0x4f5f35+_0x2bf1b8(0x16e),_0xefd03a),reportMorphError({'error_message':_0xefd03a,'error_type':_0xde95c2 instanceof Error?_0xde95c2[_0x2bf1b8(0x210)][_0x2bf1b8(0x21b)]:'UnknownError','context':{'tool':_0x2bf1b8(0x27c),'github_url':_0x3499be,'search_string':_0x3f7e8a[_0x2bf1b8(0x262)]['search_string'],'branch':_0x3f7e8a['data'][_0x2bf1b8(0x225)]},'stack_trace':_0xde95c2 instanceof Error?_0xde95c2[_0x2bf1b8(0x1e9)]:undefined,'source':'mcp-filesystem','tool':_0x2bf1b8(0x27c),'latency_ms':_0x4f5f35})['catch'](()=>{}),{'content':[{'type':_0x2bf1b8(0x1fa),'text':'GitHub\x20search\x20failed:\x20'+_0xefd03a}],'isError':![]};}}default:throw new Error(_0x2bf1b8(0x1f9)+_0x3208b7);}}catch(_0xba8649){const _0x594a3d=_0xba8649 instanceof Error?_0xba8649[_0x2bf1b8(0x22c)]:String(_0xba8649);return reportMorphError({'error_message':_0x594a3d,'error_type':_0xba8649 instanceof Error?_0xba8649[_0x2bf1b8(0x210)]['name']:_0x2bf1b8(0x237),'context':{'tool':_0x3208b7,'arguments':_0x4fb7d9?JSON[_0x2bf1b8(0x23b)](_0x4fb7d9)[_0x2bf1b8(0x240)](0x0,0x1f4):undefined,'mcp_server_version':_0x2bf1b8(0x235)},'stack_trace':_0xba8649 instanceof Error?_0xba8649[_0x2bf1b8(0x1e9)]:undefined,'source':_0x2bf1b8(0x167)})[_0x2bf1b8(0x181)](()=>{}),{'content':[{'type':_0x2bf1b8(0x1fa),'text':_0x2bf1b8(0x22d)+_0x594a3d}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x38355b){const _0x1f2c1b=a0_0x2a3250,_0x2e88f8=await getValidRootDirectories(_0x38355b);if(_0x2e88f8[_0x1f2c1b(0x1d3)]>0x0)allowedDirectories=[..._0x2e88f8],logMcpStderr('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x2e88f8[_0x1f2c1b(0x1d3)]+_0x1f2c1b(0x196));else{logMcpStderr(_0x1f2c1b(0x21d));if(ENABLE_WORKSPACE_MODE)try{const _0x37b8a3=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x37b8a3&&(allowedDirectories=[_0x37b8a3],logMcpStderr(_0x1f2c1b(0x24d)+_0x37b8a3));}catch(_0x8deba9){logMcpStderr(_0x1f2c1b(0x183)+_0x8deba9);}}}server[a0_0x2a3250(0x264)](RootsListChangedNotificationSchema,async()=>{const _0x3ca3d7=a0_0x2a3250;try{const _0x4219e0=await server[_0x3ca3d7(0x1d1)]();_0x4219e0&&_0x3ca3d7(0x1ab)in _0x4219e0&&await updateAllowedDirectoriesFromRoots(_0x4219e0[_0x3ca3d7(0x1ab)]);}catch(_0x5e5139){logMcpStderr(_0x3ca3d7(0x1fb),_0x5e5139 instanceof Error?_0x5e5139[_0x3ca3d7(0x22c)]:String(_0x5e5139));}}),server[a0_0x2a3250(0x1a5)]=async()=>{const _0x5e1795=a0_0x2a3250,_0x1de2d0=server[_0x5e1795(0x278)]();if(_0x1de2d0?.[_0x5e1795(0x1ab)])try{const _0x36f47d=await server[_0x5e1795(0x1d1)]();_0x36f47d&&_0x5e1795(0x1ab)in _0x36f47d?await updateAllowedDirectoriesFromRoots(_0x36f47d[_0x5e1795(0x1ab)]):logMcpStderr(_0x5e1795(0x26f));}catch(_0xba802a){logMcpStderr(_0x5e1795(0x191),_0xba802a instanceof Error?_0xba802a[_0x5e1795(0x22c)]:String(_0xba802a));}else{if(allowedDirectories[_0x5e1795(0x1d3)]>0x0)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x5e1795(0x1a4));else throw new Error('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.');}}};async function runServer(){const _0x2821e4=a0_0x2a3250,_0x2fa0ed=new StdioServerTransport();await server[_0x2821e4(0x190)](_0x2fa0ed),logMcpStderr(_0x2821e4(0x1e3)),allowedDirectories[_0x2821e4(0x1d3)]===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()['catch'](_0x27df6b=>{const _0xb1395c=a0_0x2a3250;logMcpStderr(_0xb1395c(0x245),_0x27df6b),process[_0xb1395c(0x174)](0x1);});
2
+ const a0_0x457be8=a0_0x3476;(function(_0x32276d,_0x1c752b){const _0x245844=a0_0x3476,_0x1a96e0=_0x32276d();while(!![]){try{const _0x4f0bf6=-parseInt(_0x245844(0x12e))/0x1*(-parseInt(_0x245844(0x134))/0x2)+parseInt(_0x245844(0x20b))/0x3*(-parseInt(_0x245844(0x1bc))/0x4)+-parseInt(_0x245844(0x142))/0x5+-parseInt(_0x245844(0x162))/0x6+parseInt(_0x245844(0x1d2))/0x7+-parseInt(_0x245844(0x11a))/0x8+-parseInt(_0x245844(0x19f))/0x9*(-parseInt(_0x245844(0x172))/0xa);if(_0x4f0bf6===_0x1c752b)break;else _0x1a96e0['push'](_0x1a96e0['shift']());}catch(_0x382353){_0x1a96e0['push'](_0x1a96e0['shift']());}}}(a0_0xeb99,0x61a3e));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_0x3c8535 from'fs/promises';import a0_0x5de32a from'path';import a0_0x4fc83b 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_0x1ec21a from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';import{ListReflexesArgsSchema,ReflexSummaryArgsSchema,GetReflexTracesArgsSchema,LIST_REFLEXES_DESCRIPTION,REFLEX_SUMMARY_DESCRIPTION,GET_REFLEX_TRACES_DESCRIPTION,createReflexApi,runListReflexes,runReflexSummary,runGetReflexTraces}from'./reflex-tools.js';function fixPathRepetition(_0x5bb8bc){const _0x4c1258=a0_0x3476,_0x5b4847=_0x5bb8bc[_0x4c1258(0x1ba)](a0_0x5de32a['sep'])['filter'](Boolean);if(_0x5b4847[_0x4c1258(0x1b2)]<0x2)return null;for(let _0x4dca37=Math[_0x4c1258(0x151)](_0x5b4847[_0x4c1258(0x1b2)]/0x2);_0x4dca37>=0x1;_0x4dca37--){for(let _0x2cefdf=0x0;_0x2cefdf<=_0x5b4847['length']-0x2*_0x4dca37;_0x2cefdf++){const _0x3ea02e=_0x5b4847[_0x4c1258(0x183)](_0x2cefdf,_0x2cefdf+_0x4dca37),_0x36c425=_0x5b4847[_0x4c1258(0x183)](_0x2cefdf+_0x4dca37,_0x2cefdf+0x2*_0x4dca37);if(_0x3ea02e['every']((_0x56ac84,_0x1be98c)=>_0x56ac84===_0x36c425[_0x1be98c])){const _0x187efd=[..._0x5b4847[_0x4c1258(0x183)](0x0,_0x2cefdf),..._0x5b4847[_0x4c1258(0x183)](_0x2cefdf+_0x4dca37)];return a0_0x5de32a[_0x4c1258(0x13c)]+_0x187efd['join'](a0_0x5de32a[_0x4c1258(0x13c)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x13026f=a0_0x3476;try{const _0xe34a5=require(_0x13026f(0x143));return _0xe34a5[_0x13026f(0x233)]??'unknown';}catch(_0x197e73){return logMcpStderr(_0x13026f(0x150),_0x197e73),_0x13026f(0x109);}}function printHelp(){const _0x301f2a=a0_0x3476;console['log'](_0x301f2a(0x22f)+getPackageVersion()),console[_0x301f2a(0x13b)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x301f2a(0x13b)]('\x0aOptions:'),console['log'](_0x301f2a(0x12f)),console[_0x301f2a(0x13b)](_0x301f2a(0x12d)),console[_0x301f2a(0x13b)](_0x301f2a(0x1eb)),console['log'](_0x301f2a(0x20f)),console[_0x301f2a(0x13b)]('\x20\x20morph-mcp'),console[_0x301f2a(0x13b)](_0x301f2a(0x187));}function a0_0xeb99(){const _0x4dace1=['Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','RipgrepNotAvailable','Preview\x20changes\x20without\x20applying\x20them.','\x22.\x20Known\x20tools:\x20','Fallback:\x20Using\x20workspace\x20root\x20','REFLEX_SUMMARY','WHEN\x20TO\x20USE\x20vs\x20native\x20edit/patch\x20tools:\x20prefer\x20this\x20tool\x20for\x20large\x20files,\x20multiple\x20or\x20scattered\x20edits,\x20refactors,\x20and\x20whitespace-sensitive\x20changes.\x20A\x20single\x20tiny\x20exact-string\x20replacement\x20can\x20use\x20the\x20native\x20edit/patch\x20tool.\x20If\x20this\x20tool\x20errors\x20or\x20times\x20out,\x20fall\x20back\x20to\x20native\x20edit\x20with\x20exact\x20string\x20matching.\x0a\x0a','Error\x20accessing\x20directory\x20','toLowerCase','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','roots','\x20(new\x20file)','-\x20Read\x20file\x20`','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','completed','instruction','parse','unknown\x20error','@morphllm/morphmcp\x20','linesAdded','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','MCP','version','ms:','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','errors','ENABLE_WORKSPACE_MODE','timed\x20out','finish','tool_call_id','\x20as\x20allowed\x20directory','provider_created','https://morphllm.com/api/error-report','\x20error(s)','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.','code_edit','[github_codebase_search]\x20Done\x20in\x20','❌\x20Morph\x20Edit\x20Failed:\x20','etimedout','getClientCapabilities','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','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','codebase_search','unknown','terminated','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','list_directory\x20','application/json','glob','Invalid\x20arguments:\x20','LIST_REFLEXES','realpath','match','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','morph-mcp','content','Morph\x20Edit\x20','ms.\x20Success:\x20','\x27\x20in\x20`','join','2259816yRkgXf','node_modules','PWD','FileNotFound','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','new_string','Unknown\x20tool:\x20','api-key','catch','metadata','isArray','\x20failed:\x20','MORPH_API_URL','exit','file','Parent\x20directory\x20does\x20not\x20exist:\x20','morph-','Warning:\x20','debug','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','1lPqABQ','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','SymlinkError','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','warn','\x20-\x20','1259926wFLyDR','timings','mcp-filesystem','map','role','edit_file','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.','log','sep','Relevant\x20context\x20found:','`\x20in\x20`','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','CODEBASE_SEARCH','stringify','2194205OxCVLr','../package.json','push','grep','MORPH_LARGE_APPLY','.git','default',']\x20Done\x20in\x20','Morph\x20FastApply\x20failed\x20without\x20error\x20message','safeParse','Applied','.\x20Changes:\x20','description','WarpGrepError','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','floor','composer.json','lines','toISOString','trim','name','constructor','warp_grep_complete','Created\x20File','now','readFile','argv','text','some','filePath','array','morph-warp-grep-v2.1','1927482MUbXQp','enum','isDirectory','.vscode','GET_REFLEX_TRACES','github_url','error','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','dryRun','WORKSPACE_ROOT','string','github_codebase_search','owner_repo','<file\x20path=\x22','--api-key','Error\x20running\x20fast\x20context\x20search:\x20','4670icgccT','file_path','API\x20error\x20(auth/rate-limit)','Bearer\x20','includes','describe','[could\x20not\x20read\x20file:\x20','Warning:\x20Workspace\x20fallback\x20failed:\x20','Failed\x20to\x20request\x20roots\x20from\x20client:','glob\x20\x27','stat','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.','LocalRipgrepProvider','target_filepath','search_string','tool_call_error','source','slice','changes','linesRemoved','repo_path','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','list_directory','false','path_validation_resolved','resolve','Disabled\x20tools:\x20','optional','stack','Repository\x20identifier','Example\x20format:\x0a','Tool\x20','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','response','timeout','Rules:\x0a','searchGitHub','arguments','success','completionId','command','Error:\x20','Here\x20is\x20the\x20content\x20of\x20files:\x0a','--help','read','21555kwvngX','number','linesModified','instructions','Morph\x20Edit\x20Preview','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','sk-','\x20chars)','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','message','oninitialized','status',',\x20removed\x20','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','DISABLED_TOOLS','.cursor','\x0a...\x20(truncated,\x20total:\x20','length','-\x20Preserve\x20exact\x20indentation\x0a','RipgrepError','indexOf','Unknown\x20error','GitHub\x20search\x20failed:\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','MORPH_WARP_GREP_TIMEOUT','split','.\x20Path:\x20','14636VTYnyk','files','setNotificationHandler','min','EDIT_FILE','FileReadError','-\x20Glob\x20search\x20`','data','Specific\x20commit\x20hash\x20to\x20search','Failed\x20to\x20read\x20file:\x20','\x22>\x0a','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','assistant','-\x20Listed\x20directory\x20`','grep\x20\x27','-\x20Grepped\x20\x27','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','SubToolError','pattern','tool','ENOENT','user','2135868XivWrU','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','--api-key=','completed_with_file_errors','turns','utf-8','grep_search','substring','boolean','ToolException','path','context','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','inputSchema','filter','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','morph-v3-large','WarpGrep\x20sub-tool\x20errors:\x20','\x20disabled\x20via\x20DISABLED_TOOLS','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','\x22>\x0aError\x20reading\x20file:\x20','edit','TimeoutError','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','path_validation_failed','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','messages','PathError','morph-v3-fast','listRoots','runWarpGrep_call','UnknownError','api_request_start','ReadError','dirname','has','[github_codebase_search]\x20Failed\x20in\x20','homedir','Cargo.toml','startsWith','BinaryFile','basename','payload','\x20valid\x20directories','\x0a</file>','cwd','path_validation_start','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','target_file','branch','env','access','code','Tool\x20\x22','0.2.0','object','501bStYrj','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','connect','\x0aExamples:','github_search_start','requiresApiKey','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.','package.json','all','GITHUB_CODEBASE_SEARCH',',\x20modified\x20','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','terminationReason','Parameters:\x0a','Workspace\x20mode\x20enabled:\x20Using\x20','tool_calls'];a0_0xeb99=function(){return _0x4dace1;};return a0_0xeb99();}const cliArgs=process[a0_0x457be8(0x15c)]['slice'](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x457be8(0x19d),'-h']);cliArgs[a0_0x457be8(0x15e)](_0x5dafe5=>VERSION_FLAGS[a0_0x457be8(0x1f5)](_0x5dafe5))&&(console['log'](a0_0x457be8(0x22f)+getPackageVersion()),process[a0_0x457be8(0x127)](0x0));cliArgs['some'](_0xccba06=>HELP_FLAGS[a0_0x457be8(0x1f5)](_0xccba06))&&(printHelp(),process[a0_0x457be8(0x127)](0x0));function getCliArg(_0x4318ac){const _0x5a4f2c=a0_0x457be8;for(let _0x40d353=0x0;_0x40d353<cliArgs[_0x5a4f2c(0x1b2)];_0x40d353++){const _0x5de584=cliArgs[_0x40d353];if(_0x5de584[_0x5a4f2c(0x1f9)]('--'+_0x4318ac+'='))return _0x5de584['slice'](('--'+_0x4318ac+'=')[_0x5a4f2c(0x1b2)]);if(_0x5de584==='--'+_0x4318ac&&_0x40d353+0x1<cliArgs['length'])return cliArgs[_0x40d353+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x457be8(0x1b2)];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x457be8(0x1f5)](arg))continue;if(arg[a0_0x457be8(0x1f9)](a0_0x457be8(0x1d4)))continue;if(arg===a0_0x457be8(0x170)){i++;continue;}args[a0_0x457be8(0x144)](arg);}const WORKSPACE_ROOT=process[a0_0x457be8(0x205)][a0_0x457be8(0x16b)]||process[a0_0x457be8(0x205)][a0_0x457be8(0x11c)]||process[a0_0x457be8(0x1ff)](),ENABLE_WORKSPACE_MODE=process['env'][a0_0x457be8(0xf7)]!==a0_0x457be8(0x189),MORPH_API_KEY=getCliArg(a0_0x457be8(0x121))??process['env']['MORPH_API_KEY'],MORPH_API_URL=process['env'][a0_0x457be8(0x126)],MORPH_LARGE_APPLY=process[a0_0x457be8(0x205)][a0_0x457be8(0x146)]!==a0_0x457be8(0x189),MORPH_WARP_GREP_TIMEOUT=process[a0_0x457be8(0x205)][a0_0x457be8(0x1b9)]?parseInt(process[a0_0x457be8(0x205)][a0_0x457be8(0x1b9)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x457be8(0x205)]['DISABLED_TOOLS']?new Set(process['env'][a0_0x457be8(0x1af)][a0_0x457be8(0x1ba)](',')['map'](_0x5baefd=>_0x5baefd[a0_0x457be8(0x155)]())[a0_0x457be8(0x1e0)](_0x4680d4=>_0x4680d4[a0_0x457be8(0x1b2)]>0x0)):DEFAULT_DISABLED_TOOLS;function a0_0x3476(_0x3afb36,_0x1453d1){_0x3afb36=_0x3afb36-0xf5;const _0xeb99fd=a0_0xeb99();let _0x34762c=_0xeb99fd[_0x3afb36];return _0x34762c;}if(DISABLED_TOOLS['size']>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x457be8(0x1f5)](tool)&&console['error']('Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22'+tool+a0_0x457be8(0x21f)+[...KNOWN_TOOL_NAMES][a0_0x457be8(0x119)](',\x20'));}console[a0_0x457be8(0x168)](a0_0x457be8(0x18c)+[...DISABLED_TOOLS][a0_0x457be8(0x119)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x457be8(0x1f9)]('sk-')&&!MORPH_API_KEY[a0_0x457be8(0x1f9)](a0_0x457be8(0x12a))&&logMcpStderr('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x1ec39d){const _0xfc290=a0_0x457be8;try{await a0_0x1ec21a['post'](_0xfc290(0xfd),{..._0x1ec39d,'timestamp':new Date()[_0xfc290(0x154)](),'source':_0x1ec39d['source']||_0xfc290(0x136),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x1ec39d[_0xfc290(0x1dd)]}},{'timeout':0x1388,'headers':{'Content-Type':_0xfc290(0x10d),'Authorization':_0xfc290(0x175)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x452445,_0x3d34c7){const _0x5f2df5=a0_0x457be8;if(_0x452445&&typeof _0x452445===_0x5f2df5(0x20a)&&_0x5f2df5(0x1aa)in _0x452445)return _0x452445['status'];if(_0x452445&&typeof _0x452445===_0x5f2df5(0x20a)&&_0x5f2df5(0x193)in _0x452445)return _0x452445[_0x5f2df5(0x193)]?.[_0x5f2df5(0x1aa)];const _0x199d40=_0x3d34c7[_0x5f2df5(0x112)](/\b(401|429)\b/);return _0x199d40?parseInt(_0x199d40[0x1],0xa):null;}function handleMorphAPIError(_0x43c570){const _0x492fd8=a0_0x457be8,_0xd81c3f=_0x43c570 instanceof Error?_0x43c570[_0x492fd8(0x1a8)]:String(_0x43c570),_0x2baf6e=extractStatusCode(_0x43c570,_0xd81c3f);switch(_0x2baf6e){case 0x191:return{'content':[{'type':'text','text':_0x492fd8(0x212)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x492fd8(0x15d),'text':_0x492fd8(0x13f)}],'isError':!![]};default:return null;}}let reflexApi=null;function getReflexApi(){if(!reflexApi)reflexApi=createReflexApi(MORPH_API_KEY,MORPH_API_URL);return reflexApi;}async function runReflexTool(_0x2b3735,_0x53900e){const _0x4412a7=a0_0x457be8,_0x1d1f62=Date[_0x4412a7(0x15a)]();try{const _0x3ecac4=await _0x53900e();return logMcpStderr('['+_0x2b3735+_0x4412a7(0x149)+(Date[_0x4412a7(0x15a)]()-_0x1d1f62)+'ms'),{'content':[{'type':_0x4412a7(0x15d),'text':_0x3ecac4}]};}catch(_0xa0ebac){const _0x55f5f0=handleMorphAPIError(_0xa0ebac);if(_0x55f5f0)return _0x55f5f0;const _0x214837=Date[_0x4412a7(0x15a)]()-_0x1d1f62,_0x326438=_0xa0ebac instanceof Error?_0xa0ebac['message']:String(_0xa0ebac);return logMcpStderr('['+_0x2b3735+']\x20Failed\x20in\x20'+_0x214837+_0x4412a7(0x234),_0x326438),reportMorphError({'error_message':_0x326438,'error_type':_0xa0ebac instanceof Error?_0xa0ebac[_0x4412a7(0x157)]['name']:_0x4412a7(0x1f1),'context':{'tool':_0x2b3735},'stack_trace':_0xa0ebac instanceof Error?_0xa0ebac[_0x4412a7(0x18e)]:undefined,'source':'mcp-filesystem','tool':_0x2b3735,'latency_ms':_0x214837})[_0x4412a7(0x122)](()=>{}),{'content':[{'type':_0x4412a7(0x15d),'text':_0x2b3735+_0x4412a7(0x125)+_0x326438}],'isError':!![]};}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x457be8(0x106)),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x457be8(0x1ae)),logMcpStderr(a0_0x457be8(0x20d)));function normalizePath(_0x226c36){return a0_0x5de32a['normalize'](_0x226c36);}function expandHome(_0x2a6b7a){const _0x4ed18d=a0_0x457be8;if(_0x2a6b7a[_0x4ed18d(0x1f9)]('~/')||_0x2a6b7a==='~')return a0_0x5de32a[_0x4ed18d(0x119)](a0_0x4fc83b[_0x4ed18d(0x1f7)](),_0x2a6b7a[_0x4ed18d(0x183)](0x1));return _0x2a6b7a;}let allowedDirectories=await Promise[a0_0x457be8(0x214)](args[a0_0x457be8(0x137)](async _0x34af70=>{const _0x111ae4=a0_0x457be8,_0x474341=expandHome(_0x34af70),_0x11abaf=a0_0x5de32a['resolve'](_0x474341);try{const _0xe0b000=await a0_0x3c8535[_0x111ae4(0x111)](_0x11abaf);return normalizePath(_0xe0b000);}catch(_0x42783d){return normalizePath(_0x11abaf);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x457be8(0x1b2)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x457be8(0x144)](workspaceDir),logMcpStderr(a0_0x457be8(0x21a)+workspaceDir+a0_0x457be8(0xfb)));}catch(a0_0x28148b){logMcpStderr(a0_0x457be8(0x21c)+a0_0x28148b);}async function detectWorkspaceRoot(_0x3ff906){const _0x3582d6=a0_0x457be8;let _0x25c016=a0_0x5de32a[_0x3582d6(0x18b)](_0x3ff906);const _0x29ec45=[_0x3582d6(0x147),_0x3582d6(0x165),_0x3582d6(0x213),_0x3582d6(0x1f8),'pyproject.toml','go.mod',_0x3582d6(0x1b0),'tsconfig.json',_0x3582d6(0x152)];while(_0x25c016!==a0_0x5de32a[_0x3582d6(0x1f4)](_0x25c016)){for(const _0x1965eb of _0x29ec45){const _0x4500b6=a0_0x5de32a[_0x3582d6(0x119)](_0x25c016,_0x1965eb);try{return await a0_0x3c8535[_0x3582d6(0x206)](_0x4500b6),normalizePath(_0x25c016);}catch{}}_0x25c016=a0_0x5de32a['dirname'](_0x25c016);}return normalizePath(_0x3ff906);}await Promise[a0_0x457be8(0x214)](args['map'](async _0x38ceda=>{const _0x4676df=a0_0x457be8;try{const _0xbe61bb=await a0_0x3c8535[_0x4676df(0x17c)](expandHome(_0x38ceda));!_0xbe61bb[_0x4676df(0x164)]()&&(logMcpStderr(_0x4676df(0x19b)+_0x38ceda+'\x20is\x20not\x20a\x20directory'),process[_0x4676df(0x127)](0x1));}catch(_0x2e821d){logMcpStderr(_0x4676df(0x223)+_0x38ceda+':',_0x2e821d),process[_0x4676df(0x127)](0x1);}}));async function validatePath(_0x5c2c71){const _0x263c5e=a0_0x457be8,_0x23bc9c=expandHome(_0x5c2c71),_0x4fce84=a0_0x5de32a[_0x263c5e(0x18b)](_0x23bc9c);logger[_0x263c5e(0x12c)](_0x263c5e(0x232),_0x263c5e(0x200),{'raw_path':_0x5c2c71,'absolute':_0x4fce84});try{const _0x264624=await a0_0x3c8535[_0x263c5e(0x111)](_0x4fce84);return logger[_0x263c5e(0x12c)]('MCP',_0x263c5e(0x18a),{'resolved':_0x264624,'symlink':_0x264624!==_0x4fce84}),_0x264624;}catch(_0x330375){if(_0x330375['code']===_0x263c5e(0x1d0)){const _0x5df982=a0_0x5de32a['dirname'](_0x4fce84);try{const _0x1f015e=await a0_0x3c8535[_0x263c5e(0x111)](_0x5df982),_0x57b662=a0_0x5de32a['join'](_0x1f015e,a0_0x5de32a[_0x263c5e(0x1fb)](_0x4fce84));return logger[_0x263c5e(0x12c)]('MCP',_0x263c5e(0x18a),{'resolved':_0x57b662,'new_file':!![]}),_0x57b662;}catch{logger[_0x263c5e(0x168)](_0x263c5e(0x232),_0x263c5e(0x1ea),{'raw_path':_0x5c2c71,'error':_0x263c5e(0x129)+_0x5df982});throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x5df982);}}logger['error'](_0x263c5e(0x232),_0x263c5e(0x1ea),{'raw_path':_0x5c2c71,'error':_0x330375[_0x263c5e(0x1a8)]});throw _0x330375;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x457be8(0x16c)](),'code_edit':z['string']()['describe']('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z[a0_0x457be8(0x16c)]()[a0_0x457be8(0x177)](a0_0x457be8(0x169)),'dryRun':z[a0_0x457be8(0x1da)]()[a0_0x457be8(0x148)](![])[a0_0x457be8(0x177)](a0_0x457be8(0x21e))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x457be8(0xff),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x457be8(0x16c)]()[a0_0x457be8(0x177)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()[a0_0x457be8(0x177)](a0_0x457be8(0x1c7)),'search_type':z[a0_0x457be8(0x163)](['default','node_modules'])[a0_0x457be8(0x18d)]()[a0_0x457be8(0x177)](a0_0x457be8(0x1e1))}),WarpGrepGitHubArgsSchema=z[a0_0x457be8(0x20a)]({'search_string':z[a0_0x457be8(0x16c)]()[a0_0x457be8(0x177)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x457be8(0x16c)]()[a0_0x457be8(0x18d)]()[a0_0x457be8(0x177)](a0_0x457be8(0x17d)),'owner_repo':z['string']()[a0_0x457be8(0x18d)]()['describe'](a0_0x457be8(0x225)),'branch':z[a0_0x457be8(0x16c)]()['optional']()[a0_0x457be8(0x177)](a0_0x457be8(0x1de))}),CodebaseSearchArgsSchema=z[a0_0x457be8(0x20a)]({'query':z[a0_0x457be8(0x16c)]()[a0_0x457be8(0x177)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x457be8(0x16c)]()['describe'](a0_0x457be8(0x18f)),'branch':z[a0_0x457be8(0x16c)]()[a0_0x457be8(0x18d)]()[a0_0x457be8(0x177)](a0_0x457be8(0x11e)),'commitHash':z[a0_0x457be8(0x16c)]()[a0_0x457be8(0x18d)]()[a0_0x457be8(0x177)](a0_0x457be8(0x1c4)),'targetDirectories':z[a0_0x457be8(0x160)](z[a0_0x457be8(0x16c)]())[a0_0x457be8(0x148)]([])[a0_0x457be8(0x177)](a0_0x457be8(0x1cc)),'limit':z[a0_0x457be8(0x1a0)]()['optional']()[a0_0x457be8(0x148)](0xa)['describe']('Max\x20results\x20to\x20return')}),server=new Server({'name':a0_0x457be8(0x114),'version':a0_0x457be8(0x209)},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x24d00b=a0_0x457be8,_0x4ac014=[{'name':TOOL_NAMES[_0x24d00b(0x1c0)],'description':_0x24d00b(0x1b8)+_0x24d00b(0x222)+_0x24d00b(0x219)+_0x24d00b(0x229)+'-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a'+_0x24d00b(0x202)+_0x24d00b(0x107)+_0x24d00b(0x190)+_0x24d00b(0x1a7)+_0x24d00b(0x195)+_0x24d00b(0x1a4)+_0x24d00b(0x1b3)+_0x24d00b(0x113)+_0x24d00b(0x131),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES['CODEBASE_SEARCH'],'description':_0x24d00b(0x1e9)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x24d00b(0x192)+_0x24d00b(0x217)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x24d00b(0x110)],'description':LIST_REFLEXES_DESCRIPTION,'inputSchema':zodToJsonSchema(ListReflexesArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES['REFLEX_SUMMARY'],'description':REFLEX_SUMMARY_DESCRIPTION,'inputSchema':zodToJsonSchema(ReflexSummaryArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x24d00b(0x166)],'description':GET_REFLEX_TRACES_DESCRIPTION,'inputSchema':zodToJsonSchema(GetReflexTracesArgsSchema),'requiresApiKey':!![]}],_0x4b2fb9=_0x4ac014[_0x24d00b(0x1e0)](_0x4eb399=>{const _0x338576=_0x24d00b;if(DISABLED_TOOLS[_0x338576(0x1f5)](_0x4eb399[_0x338576(0x156)]))return console[_0x338576(0x168)](_0x338576(0x191)+_0x4eb399[_0x338576(0x156)]+_0x338576(0x1e4)),![];if(_0x338576(0x211)in _0x4eb399&&_0x4eb399['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0x338576(0x12b)+_0x4eb399[_0x338576(0x156)]+_0x338576(0xf5)),![];return!![];});return{'tools':_0x4b2fb9[_0x24d00b(0x137)](_0x933f97=>({'name':_0x933f97['name'],'description':_0x933f97[_0x24d00b(0x14e)],'inputSchema':_0x933f97[_0x24d00b(0x1df)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x345d8b=>{const _0x5ecd8a=a0_0x457be8,{name:_0x3d9e3d,arguments:_0x40ca10}=_0x345d8b['params'],_0x395344=Date['now']();logger['debug'](_0x5ecd8a(0x232),'tool_call_received',{'tool':_0x3d9e3d,'args':_0x3d9e3d===_0x5ecd8a(0x139)?{'path':_0x40ca10?.[_0x5ecd8a(0x1dc)],'instruction':_0x40ca10?.[_0x5ecd8a(0x22c)]||_0x40ca10?.[_0x5ecd8a(0x1a2)],'dryRun':_0x40ca10?.['dryRun']}:_0x40ca10});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x5ecd8a(0x15d),'text':_0x5ecd8a(0x231)}],'isError':!![]};if(!MORPH_API_KEY[_0x5ecd8a(0x1f9)](_0x5ecd8a(0x1a5))&&!MORPH_API_KEY['startsWith'](_0x5ecd8a(0x12a)))return{'content':[{'type':'text','text':_0x5ecd8a(0x13a)}],'isError':!![]};if(DISABLED_TOOLS['has'](_0x3d9e3d))return{'content':[{'type':'text','text':_0x5ecd8a(0x208)+_0x3d9e3d+_0x5ecd8a(0x105)}],'isError':![]};switch(_0x3d9e3d){case TOOL_NAMES[_0x5ecd8a(0x1c0)]:{let _0x20ffd6=_0x40ca10;if(_0x20ffd6&&typeof _0x20ffd6===_0x5ecd8a(0x20a)){if(!(_0x5ecd8a(0x1dc)in _0x20ffd6)){const _0x4bf471=_0x20ffd6[_0x5ecd8a(0x203)]??_0x20ffd6[_0x5ecd8a(0x15f)]??_0x20ffd6[_0x5ecd8a(0x17f)]??_0x20ffd6[_0x5ecd8a(0x173)]??_0x20ffd6[_0x5ecd8a(0x128)];if(_0x4bf471)_0x20ffd6={..._0x20ffd6,'path':_0x4bf471};}'instructions'in _0x20ffd6&&!(_0x5ecd8a(0x22c)in _0x20ffd6)&&(_0x20ffd6={..._0x20ffd6,'instruction':_0x20ffd6[_0x5ecd8a(0x1a2)]});if(!(_0x5ecd8a(0x100)in _0x20ffd6)){const _0x57374a=_0x20ffd6[_0x5ecd8a(0x207)]??_0x20ffd6[_0x5ecd8a(0x11f)]??_0x20ffd6['content']??_0x20ffd6[_0x5ecd8a(0x1e7)];if(_0x57374a)_0x20ffd6={..._0x20ffd6,'code_edit':_0x57374a};}}const _0x419f49=MorphEditFileArgsSchema[_0x5ecd8a(0x14b)](_0x20ffd6);if(!_0x419f49[_0x5ecd8a(0x198)])throw new Error(_0x5ecd8a(0x1e5)+_0x419f49[_0x5ecd8a(0x168)]);const _0x71042d=await validatePath(_0x419f49['data'][_0x5ecd8a(0x1dc)]);let _0x4faf09=null,_0x9b6df0=!![],_0x64ba2d=null;try{_0x4faf09=await a0_0x3c8535[_0x5ecd8a(0x15b)](_0x71042d,_0x5ecd8a(0x1d7)),logger['debug'](_0x5ecd8a(0x232),'file_read_complete',{'path':_0x71042d,'size_bytes':_0x4faf09[_0x5ecd8a(0x1b2)]});}catch(_0x4a2dad){const _0x284403=_0x4a2dad['code'];_0x284403===_0x5ecd8a(0x1d0)?(_0x9b6df0=![],_0x4faf09='',logger[_0x5ecd8a(0x12c)](_0x5ecd8a(0x232),'file_read_complete',{'path':_0x71042d,'exists':![]})):(_0x64ba2d=_0x5ecd8a(0x1c5)+(_0x284403||'unknown')+_0x5ecd8a(0x133)+(_0x4a2dad instanceof Error?_0x4a2dad[_0x5ecd8a(0x1a8)]:String(_0x4a2dad)),logger[_0x5ecd8a(0x168)](_0x5ecd8a(0x232),'file_read_failed',{'path':_0x71042d,'error':_0x64ba2d}),logMcpStderr(_0x5ecd8a(0x12b)+_0x64ba2d));}let _0x8a68dd;try{const _0x59d528=MORPH_API_KEY;if(!_0x59d528)throw new Error(_0x5ecd8a(0x1ad));const _0x338505=a0_0x5de32a['dirname'](_0x71042d),_0x15848a=a0_0x5de32a['basename'](_0x71042d);logger[_0x5ecd8a(0x12c)](_0x5ecd8a(0x232),_0x5ecd8a(0x1f2),{'model':_0x5ecd8a(0x1ee),'path':_0x419f49[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x1dc)],'instruction_len':_0x419f49[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x22c)]['length'],'code_edit_len':_0x419f49[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x100)]['length'],'original_code_len':_0x4faf09?.[_0x5ecd8a(0x1b2)]??0x0,'dry_run':_0x419f49[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x16a)]});const _0x35d54f=Date['now'](),_0x19dd33=await executeEditFile({'target_filepath':_0x15848a,'code_edit':_0x419f49[_0x5ecd8a(0x1c3)]['code_edit'],'instruction':_0x419f49[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x22c)]},{'morphApiKey':_0x59d528,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x338505,'autoWrite':!_0x419f49[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x16a)],'generateUdiff':![],'debug':![]}),_0x46ae19=Date['now']()-_0x35d54f;_0x8a68dd=_0x19dd33[_0x5ecd8a(0x199)];if(!_0x19dd33['success'])throw new Error(_0x19dd33[_0x5ecd8a(0x168)]||_0x5ecd8a(0x14a));const _0x342a55=_0x19dd33[_0x5ecd8a(0x184)],_0x340643='added\x20'+_0x342a55[_0x5ecd8a(0x230)]+_0x5ecd8a(0x1ab)+_0x342a55[_0x5ecd8a(0x185)]+_0x5ecd8a(0x216)+_0x342a55[_0x5ecd8a(0x1a1)];logger['debug']('MCP','tool_call_complete',{'tool':'edit_file','success':!![],'latency_ms':Date[_0x5ecd8a(0x15a)]()-_0x395344,'edit_latency_ms':_0x46ae19,'changes':{'added':_0x342a55[_0x5ecd8a(0x230)],'removed':_0x342a55['linesRemoved'],'modified':_0x342a55[_0x5ecd8a(0x1a1)]},'completion_id':_0x8a68dd});if(_0x419f49[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x16a)])return{'content':[{'type':_0x5ecd8a(0x15d),'text':_0x5ecd8a(0x1a3)+(_0x9b6df0?'':_0x5ecd8a(0x227))+':\x20'+_0x419f49[_0x5ecd8a(0x1c3)]['instruction']+_0x5ecd8a(0x14d)+_0x340643+_0x5ecd8a(0x1bb)+_0x419f49['data'][_0x5ecd8a(0x1dc)]+'.'}]};return{'content':[{'type':_0x5ecd8a(0x15d),'text':_0x5ecd8a(0x116)+(_0x9b6df0?_0x5ecd8a(0x14c):_0x5ecd8a(0x159))+':\x20'+_0x419f49[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x22c)]+_0x5ecd8a(0x14d)+_0x340643+_0x5ecd8a(0x1bb)+_0x419f49[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x1dc)]+'.'}]};}catch(_0x5d2754){const _0x39fc6b=handleMorphAPIError(_0x5d2754);if(_0x39fc6b)return logger[_0x5ecd8a(0x168)](_0x5ecd8a(0x232),'tool_call_error',{'tool':'edit_file','error':_0x5ecd8a(0x174),'latency_ms':Date['now']()-_0x395344}),_0x39fc6b;const _0x3df290=_0x5d2754 instanceof Error?_0x5d2754[_0x5ecd8a(0x1a8)]:String(_0x5d2754);return logger[_0x5ecd8a(0x168)](_0x5ecd8a(0x232),_0x5ecd8a(0x181),{'tool':_0x5ecd8a(0x139),'error':_0x3df290,'path':_0x419f49[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x1dc)],'validated_path':_0x71042d,'latency_ms':Date[_0x5ecd8a(0x15a)]()-_0x395344,'stack':_0x5d2754 instanceof Error?_0x5d2754[_0x5ecd8a(0x18e)]:undefined}),reportMorphError({'error_message':_0x3df290,'error_type':_0x5d2754 instanceof Error?_0x5d2754['constructor'][_0x5ecd8a(0x156)]:_0x5ecd8a(0x1f1),'context':{'tool':_0x5ecd8a(0x139),'completion_id':_0x8a68dd,'file_path':_0x419f49[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x1dc)],'validated_path':_0x71042d,'instruction':_0x419f49[_0x5ecd8a(0x1c3)]['instruction'],'model':MORPH_LARGE_APPLY?_0x5ecd8a(0x1e2):_0x5ecd8a(0x1ee),'dry_run':_0x419f49['data']['dryRun'],'file_exists':_0x9b6df0,'file_read_error':_0x64ba2d,'file_readable':_0x4faf09!==null,'request_content':{'path':_0x419f49[_0x5ecd8a(0x1c3)]['path'],'code_edit':_0x419f49[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x100)],'instruction':_0x419f49['data']['instruction'],'original_code':_0x4faf09!==null?_0x4faf09[_0x5ecd8a(0x1b2)]>0xc350?_0x4faf09[_0x5ecd8a(0x1d9)](0x0,0xc350)+_0x5ecd8a(0x1b1)+_0x4faf09['length']+_0x5ecd8a(0x1a6):_0x4faf09:_0x5ecd8a(0x178)+(_0x64ba2d||_0x5ecd8a(0x22e))+']','original_code_length':_0x4faf09?.[_0x5ecd8a(0x1b2)]??0x0,'model':MORPH_LARGE_APPLY?'morph-v3-large':'morph-v3-fast','dry_run':_0x419f49[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x16a)]}},'stack_trace':_0x5d2754 instanceof Error?_0x5d2754[_0x5ecd8a(0x18e)]:undefined,'source':'mcp-filesystem'})[_0x5ecd8a(0x122)](()=>{}),{'content':[{'type':'text','text':_0x5ecd8a(0x102)+_0x3df290}],'isError':!![]};}}case TOOL_NAMES[_0x5ecd8a(0x140)]:{const _0x16d9f4=WarpGrepArgsSchema['safeParse'](_0x40ca10);if(!_0x16d9f4['success'])return{'content':[{'type':_0x5ecd8a(0x15d),'text':_0x5ecd8a(0x10f)+_0x16d9f4[_0x5ecd8a(0x168)]}],'isError':!![]};const _0x5753cd=_0x13f46e=>{const _0x488105=_0x5ecd8a,_0x4cc38a=[];for(const _0x4c3538 of _0x13f46e||[]){if(_0x4c3538[_0x488105(0x138)]==='assistant'&&Array[_0x488105(0x124)](_0x4c3538['tool_calls']))for(const _0x422200 of _0x4c3538[_0x488105(0x21b)]){try{const _0xb2c0b9=_0x422200['function']?.[_0x488105(0x156)],_0x1e5586=JSON[_0x488105(0x22d)](_0x422200['function']?.[_0x488105(0x197)]||'{}');if(_0xb2c0b9===_0x488105(0x1d8))_0x4cc38a[_0x488105(0x144)](_0x488105(0x1ca)+_0x1e5586[_0x488105(0x1ce)]+'\x27\x20'+(_0x1e5586['path']||'.'));else{if(_0xb2c0b9===_0x488105(0x19e))_0x4cc38a[_0x488105(0x144)]('read\x20'+_0x1e5586[_0x488105(0x1dc)]);else{if(_0xb2c0b9===_0x488105(0x188))_0x4cc38a[_0x488105(0x144)](_0x488105(0x10c)+(_0x1e5586[_0x488105(0x19a)]||'.'));else{if(_0xb2c0b9===_0x488105(0x10e))_0x4cc38a['push'](_0x488105(0x17b)+_0x1e5586[_0x488105(0x1ce)]+'\x27\x20'+(_0x1e5586[_0x488105(0x1dc)]||'.'));else _0xb2c0b9===_0x488105(0xf9)&&_0x4cc38a[_0x488105(0x144)](_0x488105(0xf9));}}}}catch{}}}return _0x4cc38a;},_0xb37e0d=_0x18157b=>{const _0x1976df=_0x5ecd8a,_0x3eb9c4=[];if(!_0x18157b||!Array['isArray'](_0x18157b))return _0x3eb9c4;const _0x3f236b=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x1976df(0x11d),'tool':_0x1976df(0x19e)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x1976df(0x1ed),'tool':_0x1976df(0x19e)},{'pattern':/\[READ ERROR\]/,'error_type':_0x1976df(0x1f3),'tool':_0x1976df(0x19e)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x1976df(0x1fa),'tool':_0x1976df(0x19e)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x1976df(0x1b4),'tool':_0x1976df(0x145)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x1976df(0x21d),'tool':_0x1976df(0x145)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x1976df(0x1fa),'tool':_0x1976df(0x19e)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':'read'},{'pattern':/not a text file/,'error_type':_0x1976df(0x1fa),'tool':_0x1976df(0x19e)},{'pattern':/symbolic link/,'error_type':_0x1976df(0x130),'tool':'read'},{'pattern':/Error reading file:/,'error_type':_0x1976df(0x1f3),'tool':'read'},{'pattern':/status="error"/,'error_type':_0x1976df(0x1db),'tool':_0x1976df(0x109)}];let _0x13942b=0x0;for(const _0x169ea1 of _0x18157b){_0x169ea1[_0x1976df(0x138)]===_0x1976df(0x1c8)&&Array['isArray'](_0x169ea1[_0x1976df(0x21b)])&&_0x13942b++;const _0x2e8263=_0x169ea1['content'];if((_0x169ea1[_0x1976df(0x138)]===_0x1976df(0x1cf)||_0x169ea1[_0x1976df(0x138)]===_0x1976df(0x1d1))&&_0x2e8263&&typeof _0x2e8263==='string')for(const {pattern:_0x342241,error_type:_0x526d13,tool:_0x3c704d}of _0x3f236b){const _0x22fc4a=_0x2e8263[_0x1976df(0x112)](new RegExp(_0x342241[_0x1976df(0x182)],'g'));if(_0x22fc4a)for(const _0x85f1e9 of _0x22fc4a){const _0x16706c=_0x2e8263[_0x1976df(0x1b5)](_0x85f1e9),_0x3edfb4=_0x2e8263['substring'](_0x16706c,Math[_0x1976df(0x1bf)](_0x16706c+0xc8,_0x2e8263[_0x1976df(0x1b2)]));_0x3eb9c4[_0x1976df(0x144)]({'tool':_0x3c704d,'error_type':_0x526d13,'error_message':_0x3edfb4[_0x1976df(0x1ba)]('\x0a')[0x0],'turn':_0x13942b});}}}return _0x3eb9c4;};try{const _0x11205c=a0_0x5de32a['resolve'](_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x186)]),_0x50500a=_0x16d9f4['data']['search_type'],_0x4fbe9d=_0x50500a===_0x5ecd8a(0x11b)?{'allowNames':[_0x5ecd8a(0x11b)]}:undefined,_0x4157da=new LocalRipgrepProvider(_0x11205c,undefined,_0x4fbe9d);logger[_0x5ecd8a(0x12c)](_0x5ecd8a(0x232),_0x5ecd8a(0xfc),{'type':_0x5ecd8a(0x17e),'repo_root':_0x11205c,'search_type':_0x50500a||_0x5ecd8a(0x148)}),logger['debug'](_0x5ecd8a(0x232),'warp_grep_start',{'query':_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x180)],'repo_root':_0x11205c,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x579e5a=Date[_0x5ecd8a(0x15a)](),_0x3ba15b=await runWarpGrep({'searchTerm':_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x180)],'repoRoot':_0x11205c,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x4157da,'search_type':_0x50500a}),_0x1a9490=Date[_0x5ecd8a(0x15a)]()-_0x579e5a,_0x400c8a=_0x3ba15b['finish']?.[_0x5ecd8a(0x123)]?.[_0x5ecd8a(0x1bd)]?.['length']??0x0;logger[_0x5ecd8a(0x12c)](_0x5ecd8a(0x232),_0x5ecd8a(0x158),{'termination':_0x3ba15b[_0x5ecd8a(0x218)],'turns':_0x3ba15b['timings']?.[_0x5ecd8a(0x1d6)]??0x0,'files_found':_0x400c8a,'latency_ms':_0x1a9490});const _0x25a2a5=_0xb37e0d(_0x3ba15b[_0x5ecd8a(0x1ec)]);_0x25a2a5[_0x5ecd8a(0x1b2)]>0x0&&reportMorphError({'error_message':_0x5ecd8a(0x1e3)+_0x25a2a5[_0x5ecd8a(0x1b2)]+_0x5ecd8a(0xfe),'error_type':_0x5ecd8a(0x1cd),'level':_0x5ecd8a(0x132),'tool':_0x5ecd8a(0x108),'context':{'repo_path':_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x186)],'query':_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x180)],'model':_0x5ecd8a(0x161),'termination_reason':_0x3ba15b[_0x5ecd8a(0x218)],'sub_tool_errors':_0x25a2a5,'timings':_0x3ba15b[_0x5ecd8a(0x135)],'tool_calls':_0x5753cd(_0x3ba15b[_0x5ecd8a(0x1ec)]),'messages':_0x3ba15b[_0x5ecd8a(0x1ec)]?.[_0x5ecd8a(0x137)](_0x4c7388=>({'role':_0x4c7388[_0x5ecd8a(0x138)],'content':_0x4c7388[_0x5ecd8a(0x115)],..._0x4c7388[_0x5ecd8a(0x21b)]?{'tool_calls':_0x4c7388['tool_calls'][_0x5ecd8a(0x1b2)]}:{},..._0x4c7388[_0x5ecd8a(0xfa)]?{'tool_call_id':_0x4c7388['tool_call_id']}:{}}))},'source':_0x5ecd8a(0x136)})[_0x5ecd8a(0x122)](()=>{});let _0x2596c5='';if(_0x3ba15b['terminationReason']===_0x5ecd8a(0x22b)&&_0x3ba15b[_0x5ecd8a(0xf9)]?.[_0x5ecd8a(0x123)]?.[_0x5ecd8a(0x1bd)]){const _0x2a9cbe=_0x3ba15b[_0x5ecd8a(0xf9)][_0x5ecd8a(0x123)][_0x5ecd8a(0x1bd)];if(_0x2a9cbe['length']===0x0)return _0x2596c5=_0x3ba15b[_0x5ecd8a(0xf9)][_0x5ecd8a(0x1fc)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x5ecd8a(0x15d),'text':_0x2596c5}]};const _0xb87722=[],_0x3733a9=[_0x5ecd8a(0x10b)];for(const _0x1c0bd3 of _0x3ba15b['messages']){if(_0x1c0bd3['role']===_0x5ecd8a(0x1c8)&&Array[_0x5ecd8a(0x124)](_0x1c0bd3['tool_calls']))for(const _0x53521a of _0x1c0bd3['tool_calls']){try{const _0x415b2e=_0x53521a['function']?.[_0x5ecd8a(0x156)],_0x237a35=JSON['parse'](_0x53521a['function']?.[_0x5ecd8a(0x197)]||'{}');if(_0x415b2e===_0x5ecd8a(0x1d8))_0x3733a9[_0x5ecd8a(0x144)](_0x5ecd8a(0x1cb)+_0x237a35[_0x5ecd8a(0x1ce)]+_0x5ecd8a(0x118)+(_0x237a35['path']||'.')+'`');else{if(_0x415b2e===_0x5ecd8a(0x19e))_0x3733a9[_0x5ecd8a(0x144)](_0x5ecd8a(0x228)+_0x237a35[_0x5ecd8a(0x1dc)]+'`');else{if(_0x415b2e==='list_directory')_0x3733a9[_0x5ecd8a(0x144)](_0x5ecd8a(0x1c9)+(_0x237a35[_0x5ecd8a(0x19a)]||'.')+'`');else _0x415b2e===_0x5ecd8a(0x10e)&&_0x3733a9[_0x5ecd8a(0x144)](_0x5ecd8a(0x1c2)+_0x237a35[_0x5ecd8a(0x1ce)]+_0x5ecd8a(0x13e)+(_0x237a35['path']||'.')+'`');}}}catch{}}}_0xb87722['push'](_0x3733a9[_0x5ecd8a(0x119)]('\x0a'));const _0x1b3457=['',_0x5ecd8a(0x13d)];for(const _0x401b4f of _0x2a9cbe){if(_0x401b4f[_0x5ecd8a(0x153)]==='*')_0x1b3457['push']('-\x20'+_0x401b4f[_0x5ecd8a(0x1dc)]+':*');else{if(Array[_0x5ecd8a(0x124)](_0x401b4f[_0x5ecd8a(0x153)])){const _0x583791=_0x401b4f[_0x5ecd8a(0x153)][_0x5ecd8a(0x137)](([_0xee7ed,_0x514c83])=>{if(_0xee7ed===_0x514c83)return''+_0xee7ed;return _0xee7ed+'-'+_0x514c83;});_0x1b3457[_0x5ecd8a(0x144)]('-\x20'+_0x401b4f[_0x5ecd8a(0x1dc)]+':'+_0x583791[_0x5ecd8a(0x119)](','));}else _0x1b3457[_0x5ecd8a(0x144)]('-\x20'+_0x401b4f[_0x5ecd8a(0x1dc)]+':*');}}_0x1b3457[_0x5ecd8a(0x144)](''),_0xb87722['push'](_0x1b3457[_0x5ecd8a(0x119)]('\x0a')),_0xb87722['push'](_0x5ecd8a(0x19c));const _0x55d15b=[],_0x42ddec=[];for(const _0x18cfbf of _0x2a9cbe){let _0x400412=a0_0x5de32a['resolve'](_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x186)],_0x18cfbf['path']),_0x1ebe83=null,_0x334fc8=null;try{_0x1ebe83=await a0_0x3c8535[_0x5ecd8a(0x15b)](_0x400412,{'encoding':_0x5ecd8a(0x1d7)});}catch(_0x2825aa){const _0x1a689e=fixPathRepetition(_0x400412);if(_0x1a689e)try{_0x1ebe83=await a0_0x3c8535[_0x5ecd8a(0x15b)](_0x1a689e,{'encoding':_0x5ecd8a(0x1d7)}),_0x400412=_0x1a689e;}catch{_0x334fc8=_0x2825aa instanceof Error?_0x2825aa:new Error(String(_0x2825aa));}else _0x334fc8=_0x2825aa instanceof Error?_0x2825aa:new Error(String(_0x2825aa));}if(_0x1ebe83!==null){const _0x2cf49d=_0x1ebe83[_0x5ecd8a(0x1ba)](/\r?\n/),_0x12c1db=[];if(_0x18cfbf[_0x5ecd8a(0x153)]==='*'||!Array[_0x5ecd8a(0x124)](_0x18cfbf['lines']))for(let _0x47bfe9=0x1;_0x47bfe9<=_0x2cf49d[_0x5ecd8a(0x1b2)];_0x47bfe9++){const _0x580552=_0x2cf49d[_0x47bfe9-0x1];_0x12c1db[_0x5ecd8a(0x144)](_0x47bfe9+'|\x20'+_0x580552);}else for(const [_0x5cb89c,_0xd7863e]of _0x18cfbf[_0x5ecd8a(0x153)]){_0x12c1db[_0x5ecd8a(0x1b2)]>0x0&&_0x12c1db[_0x5ecd8a(0x144)]('');for(let _0x5dd3fa=_0x5cb89c;_0x5dd3fa<=_0xd7863e&&_0x5dd3fa<=_0x2cf49d[_0x5ecd8a(0x1b2)];_0x5dd3fa++){const _0x342078=_0x2cf49d[_0x5dd3fa-0x1];_0x12c1db[_0x5ecd8a(0x144)](_0x5dd3fa+'|\x20'+_0x342078);}}_0x42ddec[_0x5ecd8a(0x144)]({'path':_0x18cfbf[_0x5ecd8a(0x1dc)],'content':_0x12c1db[_0x5ecd8a(0x119)]('\x0a')});}else _0x55d15b[_0x5ecd8a(0x144)](_0x5ecd8a(0x16f)+_0x18cfbf['path']+_0x5ecd8a(0x1e6)+(_0x334fc8?.[_0x5ecd8a(0x1a8)]||_0x5ecd8a(0x1b6))+_0x5ecd8a(0x1fe));}try{const _0x2fc1bc=await compactFileContexts(_0x42ddec,_0x16d9f4['data'][_0x5ecd8a(0x180)],MORPH_API_KEY,MORPH_API_URL);for(const _0x57ee2e of _0x2fc1bc){_0x55d15b[_0x5ecd8a(0x144)]('<file\x20path=\x22'+_0x57ee2e[_0x5ecd8a(0x1dc)]+_0x5ecd8a(0x1c6)+_0x57ee2e[_0x5ecd8a(0x115)]+_0x5ecd8a(0x1fe));}}catch(_0x137b08){logger[_0x5ecd8a(0x132)](_0x5ecd8a(0x232),'compaction_failed',{'error':_0x137b08 instanceof Error?_0x137b08['message']:String(_0x137b08),'files_count':_0x42ddec[_0x5ecd8a(0x1b2)]});for(const _0x1115c8 of _0x42ddec){_0x55d15b[_0x5ecd8a(0x144)](_0x5ecd8a(0x16f)+_0x1115c8['path']+_0x5ecd8a(0x1c6)+_0x1115c8[_0x5ecd8a(0x115)]+_0x5ecd8a(0x1fe));}}_0xb87722[_0x5ecd8a(0x144)](_0x55d15b['join']('\x0a\x0a')),_0x2596c5=_0xb87722[_0x5ecd8a(0x119)]('\x0a');const _0x318fbf=_0x3ba15b[_0x5ecd8a(0xf6)]?.[_0x5ecd8a(0x1e0)](_0x873c7f=>_0x873c7f[_0x5ecd8a(0x1a8)]?.['startsWith']('File\x20read\x20error:'))||[];if(_0x318fbf[_0x5ecd8a(0x1b2)]>0x0){const _0xac18cb=_0x318fbf[_0x5ecd8a(0x137)](_0x1b462b=>_0x1b462b[_0x5ecd8a(0x1a8)])['join'](';\x20');reportMorphError({'error_message':_0xac18cb,'error_type':_0x5ecd8a(0x1c1),'context':{'tool':'codebase_search','repo_path':_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x186)],'query':_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x180)],'model':_0x5ecd8a(0x161),'termination_reason':_0x5ecd8a(0x1d5),'error_count':_0x318fbf['length'],'is_timeout':![],'timings':_0x3ba15b[_0x5ecd8a(0x135)],'files_attempted':_0x2a9cbe[_0x5ecd8a(0x137)](_0x471ca7=>({'path':_0x471ca7['path'],'lines':_0x471ca7[_0x5ecd8a(0x153)]})),'tool_calls':_0x5753cd(_0x3ba15b[_0x5ecd8a(0x1ec)]),'messages':_0x3ba15b[_0x5ecd8a(0x1ec)]?.[_0x5ecd8a(0x137)](_0x4d9169=>({'role':_0x4d9169[_0x5ecd8a(0x138)],'content':_0x4d9169['content'],..._0x4d9169[_0x5ecd8a(0x21b)]?{'tool_calls':_0x4d9169[_0x5ecd8a(0x21b)][_0x5ecd8a(0x1b2)]}:{},..._0x4d9169[_0x5ecd8a(0xfa)]?{'tool_call_id':_0x4d9169[_0x5ecd8a(0xfa)]}:{}})),'request_content':{'query':_0x16d9f4['data'][_0x5ecd8a(0x180)],'repo_path':_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x186)],'repoRoot':a0_0x5de32a['resolve'](_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x186)]),'model':_0x5ecd8a(0x161)}},'source':_0x5ecd8a(0x136)})[_0x5ecd8a(0x122)](()=>{});}}else{if(_0x3ba15b[_0x5ecd8a(0x218)]===_0x5ecd8a(0x10a)&&_0x3ba15b['errors'][_0x5ecd8a(0x1b2)]>0x0){const _0x2d413a=_0x3ba15b[_0x5ecd8a(0xf6)]['map'](_0x13a0c5=>_0x13a0c5[_0x5ecd8a(0x1a8)])[_0x5ecd8a(0x119)](';\x20');_0x2596c5=_0x5ecd8a(0x19b)+_0x2d413a;const _0x590e2a=_0x2d413a['toLowerCase']()[_0x5ecd8a(0x176)](_0x5ecd8a(0x194))||_0x2d413a[_0x5ecd8a(0x224)]()[_0x5ecd8a(0x176)](_0x5ecd8a(0xf8))||_0x2d413a[_0x5ecd8a(0x224)]()[_0x5ecd8a(0x176)](_0x5ecd8a(0x103)),_0x56ff00=_0x3ba15b[_0x5ecd8a(0xf9)]?.[_0x5ecd8a(0x123)]?.['files'],_0x2db6e3=_0x3ba15b[_0x5ecd8a(0xf6)][0x0];reportMorphError({'error_message':_0x2d413a,'error_type':_0x590e2a?_0x5ecd8a(0x1e8):_0x2db6e3?.['constructor']?.['name']||_0x5ecd8a(0x14f),'context':{'tool':'codebase_search','repo_path':_0x16d9f4['data']['repo_path'],'query':_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x180)],'model':'morph-warp-grep-v2.1','termination_reason':_0x3ba15b['terminationReason'],'error_count':_0x3ba15b[_0x5ecd8a(0xf6)][_0x5ecd8a(0x1b2)],'is_timeout':_0x590e2a,'timings':_0x3ba15b['timings'],'files_attempted':_0x56ff00?.[_0x5ecd8a(0x137)](_0x428be6=>({'path':_0x428be6[_0x5ecd8a(0x1dc)],'lines':_0x428be6[_0x5ecd8a(0x153)]})),'tool_calls':_0x5753cd(_0x3ba15b['messages']),'messages':_0x3ba15b['messages']?.[_0x5ecd8a(0x137)](_0x3f8b4d=>({'role':_0x3f8b4d[_0x5ecd8a(0x138)],'content':_0x3f8b4d[_0x5ecd8a(0x115)],..._0x3f8b4d[_0x5ecd8a(0x21b)]?{'tool_calls':_0x3f8b4d[_0x5ecd8a(0x21b)][_0x5ecd8a(0x1b2)]}:{},..._0x3f8b4d[_0x5ecd8a(0xfa)]?{'tool_call_id':_0x3f8b4d[_0x5ecd8a(0xfa)]}:{}})),'request_content':{'query':_0x16d9f4[_0x5ecd8a(0x1c3)]['search_string'],'repo_path':_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x186)],'repoRoot':a0_0x5de32a['resolve'](_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x186)]),'model':_0x5ecd8a(0x161)}},'stack_trace':_0x2db6e3?.[_0x5ecd8a(0x18e)]||undefined,'source':_0x5ecd8a(0x136)})['catch'](()=>{});}else _0x2596c5='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':'text','text':_0x2596c5}]};}catch(_0x48d488){const _0x1b5306=handleMorphAPIError(_0x48d488);if(_0x1b5306)return logger[_0x5ecd8a(0x168)](_0x5ecd8a(0x232),'tool_call_error',{'tool':_0x5ecd8a(0x108),'error':_0x5ecd8a(0x174),'latency_ms':Date[_0x5ecd8a(0x15a)]()-_0x395344}),_0x1b5306;const _0x20088b=_0x48d488 instanceof Error?_0x48d488[_0x5ecd8a(0x1a8)]:String(_0x48d488);logger[_0x5ecd8a(0x168)](_0x5ecd8a(0x232),_0x5ecd8a(0x181),{'tool':_0x5ecd8a(0x108),'error':_0x20088b,'repo_path':_0x16d9f4[_0x5ecd8a(0x1c3)]['repo_path'],'query':_0x16d9f4[_0x5ecd8a(0x1c3)]['search_string'],'latency_ms':Date[_0x5ecd8a(0x15a)]()-_0x395344});const _0x343da2=_0x20088b[_0x5ecd8a(0x224)]()['includes'](_0x5ecd8a(0x194))||_0x20088b[_0x5ecd8a(0x224)]()['includes']('timed\x20out')||_0x20088b['toLowerCase']()[_0x5ecd8a(0x176)]('etimedout')||_0x48d488 instanceof Error&&_0x48d488[_0x5ecd8a(0x156)]===_0x5ecd8a(0x1e8);return reportMorphError({'error_message':_0x20088b,'error_type':_0x343da2?_0x5ecd8a(0x1e8):_0x48d488 instanceof Error?_0x48d488[_0x5ecd8a(0x157)][_0x5ecd8a(0x156)]:'UnknownError','context':{'tool':_0x5ecd8a(0x108),'repo_path':_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x186)],'query':_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x180)],'model':_0x5ecd8a(0x161),'is_timeout':_0x343da2,'exception_phase':_0x5ecd8a(0x1f0),'request_content':{'query':_0x16d9f4[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x180)],'repo_path':_0x16d9f4[_0x5ecd8a(0x1c3)]['repo_path'],'repoRoot':a0_0x5de32a['resolve'](_0x16d9f4['data'][_0x5ecd8a(0x186)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x48d488 instanceof Error?_0x48d488[_0x5ecd8a(0x18e)]:undefined,'source':_0x5ecd8a(0x136)})[_0x5ecd8a(0x122)](()=>{}),{'content':[{'type':_0x5ecd8a(0x15d),'text':_0x5ecd8a(0x171)+_0x20088b}],'isError':![]};}}case TOOL_NAMES[_0x5ecd8a(0x215)]:{const _0x57af38=WarpGrepGitHubArgsSchema['safeParse'](_0x40ca10);if(!_0x57af38['success'])return{'content':[{'type':_0x5ecd8a(0x15d),'text':_0x5ecd8a(0x10f)+_0x57af38[_0x5ecd8a(0x168)]}],'isError':!![]};const _0x4c92d7=_0x57af38['data'][_0x5ecd8a(0x167)]||_0x57af38[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x16e)];if(!_0x4c92d7)return{'content':[{'type':_0x5ecd8a(0x15d),'text':'Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id'}],'isError':!![]};const _0x3be848=MORPH_API_KEY;if(!_0x3be848)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x555b8c=Date[_0x5ecd8a(0x15a)]();logger['debug'](_0x5ecd8a(0x232),_0x5ecd8a(0x210),{'identifier':_0x4c92d7,'query':_0x57af38[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x180)],'branch':_0x57af38[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x204)]});try{const _0x9c3eb=new WarpGrepClient({'morphApiKey':_0x3be848,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x4bc2f8=await _0x9c3eb[_0x5ecd8a(0x196)]({'searchTerm':_0x57af38['data'][_0x5ecd8a(0x180)],'github':_0x4c92d7,'branch':_0x57af38[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x204)]}),_0x787f4a=Date[_0x5ecd8a(0x15a)]()-_0x555b8c;logMcpStderr(_0x5ecd8a(0x101)+_0x787f4a+_0x5ecd8a(0x117)+_0x4bc2f8[_0x5ecd8a(0x198)]);const _0x2021e0=formatResult(_0x4bc2f8);return{'content':[{'type':_0x5ecd8a(0x15d),'text':_0x2021e0}]};}catch(_0x3d77e2){const _0x3be3e4=handleMorphAPIError(_0x3d77e2);if(_0x3be3e4)return _0x3be3e4;const _0x5b75f3=Date[_0x5ecd8a(0x15a)]()-_0x555b8c,_0x1bce14=_0x3d77e2 instanceof Error?_0x3d77e2['message']:String(_0x3d77e2);return logMcpStderr(_0x5ecd8a(0x1f6)+_0x5b75f3+_0x5ecd8a(0x234),_0x1bce14),reportMorphError({'error_message':_0x1bce14,'error_type':_0x3d77e2 instanceof Error?_0x3d77e2['constructor']['name']:_0x5ecd8a(0x1f1),'context':{'tool':_0x5ecd8a(0x16d),'github_url':_0x4c92d7,'search_string':_0x57af38[_0x5ecd8a(0x1c3)][_0x5ecd8a(0x180)],'branch':_0x57af38['data']['branch']},'stack_trace':_0x3d77e2 instanceof Error?_0x3d77e2[_0x5ecd8a(0x18e)]:undefined,'source':_0x5ecd8a(0x136),'tool':'github_codebase_search','latency_ms':_0x5b75f3})[_0x5ecd8a(0x122)](()=>{}),{'content':[{'type':_0x5ecd8a(0x15d),'text':_0x5ecd8a(0x1b7)+_0x1bce14}],'isError':![]};}}case TOOL_NAMES[_0x5ecd8a(0x110)]:{const _0x5acc7d=ListReflexesArgsSchema['safeParse'](_0x40ca10??{});if(!_0x5acc7d[_0x5ecd8a(0x198)])return{'content':[{'type':'text','text':_0x5ecd8a(0x10f)+_0x5acc7d[_0x5ecd8a(0x168)]}],'isError':!![]};return runReflexTool(TOOL_NAMES[_0x5ecd8a(0x110)],()=>runListReflexes(getReflexApi()));}case TOOL_NAMES[_0x5ecd8a(0x221)]:{const _0x2d7360=ReflexSummaryArgsSchema[_0x5ecd8a(0x14b)](_0x40ca10??{});if(!_0x2d7360[_0x5ecd8a(0x198)])return{'content':[{'type':_0x5ecd8a(0x15d),'text':_0x5ecd8a(0x10f)+_0x2d7360[_0x5ecd8a(0x168)]}],'isError':!![]};return runReflexTool(TOOL_NAMES['REFLEX_SUMMARY'],()=>runReflexSummary(getReflexApi(),_0x2d7360[_0x5ecd8a(0x1c3)]));}case TOOL_NAMES[_0x5ecd8a(0x166)]:{const _0x49eee5=GetReflexTracesArgsSchema[_0x5ecd8a(0x14b)](_0x40ca10??{});if(!_0x49eee5[_0x5ecd8a(0x198)])return{'content':[{'type':_0x5ecd8a(0x15d),'text':'Invalid\x20arguments:\x20'+_0x49eee5['error']}],'isError':!![]};return runReflexTool(TOOL_NAMES[_0x5ecd8a(0x166)],()=>runGetReflexTraces(getReflexApi(),_0x49eee5[_0x5ecd8a(0x1c3)]));}default:throw new Error(_0x5ecd8a(0x120)+_0x3d9e3d);}}catch(_0x52754e){const _0xde3c92=_0x52754e instanceof Error?_0x52754e[_0x5ecd8a(0x1a8)]:String(_0x52754e);return reportMorphError({'error_message':_0xde3c92,'error_type':_0x52754e instanceof Error?_0x52754e[_0x5ecd8a(0x157)]['name']:_0x5ecd8a(0x1f1),'context':{'tool':_0x3d9e3d,'arguments':_0x40ca10?JSON[_0x5ecd8a(0x141)](_0x40ca10)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x5ecd8a(0x209)},'stack_trace':_0x52754e instanceof Error?_0x52754e['stack']:undefined,'source':_0x5ecd8a(0x136)})['catch'](()=>{}),{'content':[{'type':_0x5ecd8a(0x15d),'text':_0x5ecd8a(0x19b)+_0xde3c92}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x380605){const _0xcade97=a0_0x457be8,_0x16be46=await getValidRootDirectories(_0x380605);if(_0x16be46[_0xcade97(0x1b2)]>0x0)allowedDirectories=[..._0x16be46],logMcpStderr(_0xcade97(0x201)+_0x16be46[_0xcade97(0x1b2)]+_0xcade97(0x1fd));else{logMcpStderr(_0xcade97(0x20c));if(ENABLE_WORKSPACE_MODE)try{const _0x2bfb3f=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x2bfb3f&&(allowedDirectories=[_0x2bfb3f],logMcpStderr(_0xcade97(0x220)+_0x2bfb3f));}catch(_0x1baf3c){logMcpStderr(_0xcade97(0x179)+_0x1baf3c);}}}server[a0_0x457be8(0x1be)](RootsListChangedNotificationSchema,async()=>{const _0x59a574=a0_0x457be8;try{const _0x4a5204=await server['listRoots']();_0x4a5204&&_0x59a574(0x226)in _0x4a5204&&await updateAllowedDirectoriesFromRoots(_0x4a5204['roots']);}catch(_0x2714c2){logMcpStderr(_0x59a574(0x17a),_0x2714c2 instanceof Error?_0x2714c2[_0x59a574(0x1a8)]:String(_0x2714c2));}}),server[a0_0x457be8(0x1a9)]=async()=>{const _0x2440bf=a0_0x457be8,_0x5e58fe=server[_0x2440bf(0x104)]();if(_0x5e58fe?.['roots'])try{const _0xaf1fba=await server[_0x2440bf(0x1ef)]();_0xaf1fba&&_0x2440bf(0x226)in _0xaf1fba?await updateAllowedDirectoriesFromRoots(_0xaf1fba[_0x2440bf(0x226)]):logMcpStderr(_0x2440bf(0x22a));}catch(_0x20674e){logMcpStderr(_0x2440bf(0x1ac),_0x20674e instanceof Error?_0x20674e['message']:String(_0x20674e));}else{if(allowedDirectories[_0x2440bf(0x1b2)]>0x0)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x2440bf(0x1d3));else throw new Error('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.');}}};async function runServer(){const _0x322e67=a0_0x457be8,_0x3dc046=new StdioServerTransport();await server[_0x322e67(0x20e)](_0x3dc046),logMcpStderr('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories[_0x322e67(0x1b2)]===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x457be8(0x122)](_0x5166a8=>{logMcpStderr('Fatal\x20error\x20running\x20server:',_0x5166a8),process['exit'](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- var a1_0x253c07=a1_0x260d;function a1_0x4dcd(){var _0x5801d8=['macOS','MCP','90352qkqWDz','length','6904345NoAgnr','info','linux','10qsccau','map','4737572aKZojl','5996154jmONUL','win32','error','1412776FmNDOv','Unknown','Windows','3818613IxqusY','9998968toQuAA','platform'];a1_0x4dcd=function(){return _0x5801d8;};return a1_0x4dcd();}(function(_0x2ad0b3,_0x2f2a11){var _0x4c0ac4=a1_0x260d,_0x3859a3=_0x2ad0b3();while(!![]){try{var _0x189676=-parseInt(_0x4c0ac4(0x198))/0x1*(parseInt(_0x4c0ac4(0x19d))/0x2)+-parseInt(_0x4c0ac4(0x1a6))/0x3+-parseInt(_0x4c0ac4(0x1a3))/0x4+parseInt(_0x4c0ac4(0x19a))/0x5+parseInt(_0x4c0ac4(0x1a0))/0x6+-parseInt(_0x4c0ac4(0x19f))/0x7+parseInt(_0x4c0ac4(0x194))/0x8;if(_0x189676===_0x2f2a11)break;else _0x3859a3['push'](_0x3859a3['shift']());}catch(_0x4060c3){_0x3859a3['push'](_0x3859a3['shift']());}}}(a1_0x4dcd,0xd5bd6));import a1_0x708f6a from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x5baf4a=a1_0x708f6a[a1_0x253c07(0x195)]()){var _0x3c9af8=a1_0x253c07;switch(_0x5baf4a){case'darwin':return _0x3c9af8(0x196);case _0x3c9af8(0x1a1):return _0x3c9af8(0x1a5);case _0x3c9af8(0x19c):return'Linux';default:return _0x3c9af8(0x1a4);}}function a1_0x260d(_0x29f899,_0x4935a3){_0x29f899=_0x29f899-0x194;var _0x4dcd45=a1_0x4dcd();var _0x260dc0=_0x4dcd45[_0x29f899];return _0x260dc0;}export function formatMcpLogMessage(_0x56be43,_0x110a9f=a1_0x708f6a[a1_0x253c07(0x195)]()){return'[os='+getOperatingSystemType(_0x110a9f)+']\x20'+_0x56be43;}export function logMcpStderr(_0x33ccea,..._0x3a076d){var _0x22e841=a1_0x253c07;console[_0x22e841(0x1a2)](formatMcpLogMessage(_0x33ccea),..._0x3a076d),logger[_0x22e841(0x19b)](_0x22e841(0x197),_0x33ccea,_0x3a076d[_0x22e841(0x199)]?{'args':_0x3a076d[_0x22e841(0x19e)](_0x3a401a=>String(_0x3a401a))}:undefined);}
1
+ var a1_0x182fa7=a1_0x306c;(function(_0x3997d9,_0x5a9c82){var _0x137088=a1_0x306c,_0x4d521f=_0x3997d9();while(!![]){try{var _0x4b1427=parseInt(_0x137088(0x12e))/0x1*(parseInt(_0x137088(0x12a))/0x2)+-parseInt(_0x137088(0x135))/0x3*(-parseInt(_0x137088(0x137))/0x4)+-parseInt(_0x137088(0x12c))/0x5+parseInt(_0x137088(0x130))/0x6*(-parseInt(_0x137088(0x134))/0x7)+parseInt(_0x137088(0x138))/0x8*(parseInt(_0x137088(0x126))/0x9)+-parseInt(_0x137088(0x127))/0xa*(-parseInt(_0x137088(0x139))/0xb)+-parseInt(_0x137088(0x136))/0xc;if(_0x4b1427===_0x5a9c82)break;else _0x4d521f['push'](_0x4d521f['shift']());}catch(_0x5dc40d){_0x4d521f['push'](_0x4d521f['shift']());}}}(a1_0x1f4c,0x1db04));import a1_0x4a9eaa from'os';function a1_0x306c(_0x3f6336,_0x38e6eb){_0x3f6336=_0x3f6336-0x126;var _0x1f4c57=a1_0x1f4c();var _0x306c65=_0x1f4c57[_0x3f6336];return _0x306c65;}import{logger}from'./logger.js';function a1_0x1f4c(){var _0x1f9a59=['238edyVqs','3QdQPdI','3497292qkQlVT','388836yrbnso','272EfgTkT','11NBFAXO','15021yOGUsg','2214710bxHMrv','platform','info','24ZRJPrr','win32','80795WmbjfI','error','12378APItTe','darwin','16722YVmlau','Unknown','Windows','[os='];a1_0x1f4c=function(){return _0x1f9a59;};return a1_0x1f4c();}export function getOperatingSystemType(_0x3a7fe3=a1_0x4a9eaa[a1_0x182fa7(0x128)]()){var _0x447d94=a1_0x182fa7;switch(_0x3a7fe3){case _0x447d94(0x12f):return'macOS';case _0x447d94(0x12b):return _0x447d94(0x132);case'linux':return'Linux';default:return _0x447d94(0x131);}}export function formatMcpLogMessage(_0x5c9090,_0x111516=a1_0x4a9eaa[a1_0x182fa7(0x128)]()){var _0x36352e=a1_0x182fa7;return _0x36352e(0x133)+getOperatingSystemType(_0x111516)+']\x20'+_0x5c9090;}export function logMcpStderr(_0x4fd9fb,..._0x3531ea){var _0x3ef1dd=a1_0x182fa7;console[_0x3ef1dd(0x12d)](formatMcpLogMessage(_0x4fd9fb),..._0x3531ea),logger[_0x3ef1dd(0x129)]('MCP',_0x4fd9fb,_0x3531ea['length']?{'args':_0x3531ea['map'](_0x28807d=>String(_0x28807d))}:undefined);}
package/dist/logger.js CHANGED
@@ -1 +1 @@
1
- const a2_0x44a080=a2_0x4a66;(function(_0x13a59d,_0x16abc6){const _0x235103=a2_0x4a66,_0x126d60=_0x13a59d();while(!![]){try{const _0x31a537=-parseInt(_0x235103(0x1d5))/0x1+-parseInt(_0x235103(0x1e7))/0x2+-parseInt(_0x235103(0x1dc))/0x3*(-parseInt(_0x235103(0x1d6))/0x4)+parseInt(_0x235103(0x1d9))/0x5+parseInt(_0x235103(0x1dd))/0x6*(-parseInt(_0x235103(0x1e8))/0x7)+parseInt(_0x235103(0x1d4))/0x8*(-parseInt(_0x235103(0x1d2))/0x9)+parseInt(_0x235103(0x1db))/0xa;if(_0x31a537===_0x16abc6)break;else _0x126d60['push'](_0x126d60['shift']());}catch(_0xa2c741){_0x126d60['push'](_0x126d60['shift']());}}}(a2_0x46d9,0x89d84));import{createWriteStream}from'fs';function a2_0x4a66(_0x387fa6,_0x477beb){_0x387fa6=_0x387fa6-0x1d0;const _0x46d90f=a2_0x46d9();let _0x4a66c4=_0x46d90f[_0x387fa6];return _0x4a66c4;}function a2_0x46d9(){const _0x1a7087=['enable','26012150mhZGHn','138ylmSYc','6UlettO','fileStream','env','warn','MORPH_DEBUG','stringify','enabled',']\x20[','info','error','1065350SujojB','6188861XEGGxI','isEnabled','MORPH_LOG_FILE','7407NFgJns','write','5288wrWCVp','486367kROCPS','2364loPugU','debug','_log','1916895bcmUMG'];a2_0x46d9=function(){return _0x1a7087;};return a2_0x46d9();}class MorphLogger{[a2_0x44a080(0x1e3)];[a2_0x44a080(0x1de)];constructor(){const _0x3efc16=a2_0x44a080;this[_0x3efc16(0x1e3)]=process['env'][_0x3efc16(0x1e1)]==='1'||!!process['env']['MORPH_LOG_FILE'];const _0x3e6691=process[_0x3efc16(0x1df)][_0x3efc16(0x1d1)];this[_0x3efc16(0x1de)]=_0x3e6691?createWriteStream(_0x3e6691,{'flags':'a'}):null;}['debug'](_0x586c3b,_0x499969,_0xaef994){const _0x259629=a2_0x44a080;this['_log'](_0x259629(0x1d7),_0x586c3b,_0x499969,_0xaef994);}[a2_0x44a080(0x1e5)](_0x284b43,_0x123970,_0x4df55c){const _0x43b805=a2_0x44a080;this[_0x43b805(0x1d8)](_0x43b805(0x1e5),_0x284b43,_0x123970,_0x4df55c);}[a2_0x44a080(0x1e0)](_0x430727,_0x6ccb99,_0x458a56){const _0x12c977=a2_0x44a080;this['_log'](_0x12c977(0x1e0),_0x430727,_0x6ccb99,_0x458a56);}['error'](_0x458c98,_0x259b1f,_0xd5b2f2){this['_log']('error',_0x458c98,_0x259b1f,_0xd5b2f2);}[a2_0x44a080(0x1da)](){const _0x4b68e0=a2_0x44a080;this[_0x4b68e0(0x1e3)]=!![];}get[a2_0x44a080(0x1d0)](){const _0x1ed4f2=a2_0x44a080;return this[_0x1ed4f2(0x1e3)];}[a2_0x44a080(0x1d8)](_0x8f25dc,_0x560f35,_0x455685,_0x3de7dd){const _0x413bce=a2_0x44a080;if(_0x8f25dc!==_0x413bce(0x1e6)&&!this[_0x413bce(0x1e3)])return;const _0x568ccc=new Date()['toISOString'](),_0x44a0d5='['+_0x568ccc+_0x413bce(0x1e4)+_0x8f25dc['toUpperCase']()+']\x20['+_0x560f35+']';console[_0x413bce(0x1e6)](_0x3de7dd?_0x44a0d5+'\x20'+_0x455685+'\x20'+JSON[_0x413bce(0x1e2)](_0x3de7dd):_0x44a0d5+'\x20'+_0x455685),this[_0x413bce(0x1de)]?.[_0x413bce(0x1d3)](JSON['stringify']({'ts':_0x568ccc,'level':_0x8f25dc,'component':_0x560f35,'msg':_0x455685,..._0x3de7dd&&{'data':_0x3de7dd}})+'\x0a');}}export const logger=new MorphLogger();
1
+ const a2_0x2f7e9b=a2_0x3c13;function a2_0x3164(){const _0x44c972=['debug',']\x20[','MORPH_DEBUG','17482720CQXuDO','MORPH_LOG_FILE','6269767WnBvcR','toUpperCase','warn','807059aOBzyQ','6pEwpcG','_log','info','env','1861593KlsPpE','806380OOWdOj','enabled','1751918LTkhSR','fileStream','enable','isEnabled','error','stringify','write','4402240bwccsb'];a2_0x3164=function(){return _0x44c972;};return a2_0x3164();}(function(_0x3eb1b4,_0x1b75e0){const _0x23294c=a2_0x3c13,_0x1a58ea=_0x3eb1b4();while(!![]){try{const _0x4ee19b=parseInt(_0x23294c(0x16f))/0x1+parseInt(_0x23294c(0x177))/0x2+-parseInt(_0x23294c(0x174))/0x3+-parseInt(_0x23294c(0x175))/0x4+parseInt(_0x23294c(0x166))/0x5+-parseInt(_0x23294c(0x170))/0x6*(-parseInt(_0x23294c(0x16c))/0x7)+-parseInt(_0x23294c(0x16a))/0x8;if(_0x4ee19b===_0x1b75e0)break;else _0x1a58ea['push'](_0x1a58ea['shift']());}catch(_0x3fb285){_0x1a58ea['push'](_0x1a58ea['shift']());}}}(a2_0x3164,0x6e461));import{createWriteStream}from'fs';class MorphLogger{['enabled'];[a2_0x2f7e9b(0x178)];constructor(){const _0x11ea44=a2_0x2f7e9b;this[_0x11ea44(0x176)]=process[_0x11ea44(0x173)][_0x11ea44(0x169)]==='1'||!!process['env'][_0x11ea44(0x16b)];const _0x2c6724=process[_0x11ea44(0x173)][_0x11ea44(0x16b)];this[_0x11ea44(0x178)]=_0x2c6724?createWriteStream(_0x2c6724,{'flags':'a'}):null;}['debug'](_0x15b7aa,_0x5e800f,_0x59564e){const _0x1753f7=a2_0x2f7e9b;this[_0x1753f7(0x171)](_0x1753f7(0x167),_0x15b7aa,_0x5e800f,_0x59564e);}[a2_0x2f7e9b(0x172)](_0x3bb6ec,_0x2d78a7,_0x553cef){const _0x491beb=a2_0x2f7e9b;this[_0x491beb(0x171)](_0x491beb(0x172),_0x3bb6ec,_0x2d78a7,_0x553cef);}[a2_0x2f7e9b(0x16e)](_0x262ec6,_0x237c58,_0x3fcc85){const _0x454c2c=a2_0x2f7e9b;this[_0x454c2c(0x171)]('warn',_0x262ec6,_0x237c58,_0x3fcc85);}[a2_0x2f7e9b(0x17b)](_0x2ea12e,_0x2b9ea3,_0x36cb0e){const _0x1b7ecc=a2_0x2f7e9b;this[_0x1b7ecc(0x171)](_0x1b7ecc(0x17b),_0x2ea12e,_0x2b9ea3,_0x36cb0e);}[a2_0x2f7e9b(0x179)](){const _0x42b6ba=a2_0x2f7e9b;this[_0x42b6ba(0x176)]=!![];}get[a2_0x2f7e9b(0x17a)](){const _0x138bdc=a2_0x2f7e9b;return this[_0x138bdc(0x176)];}[a2_0x2f7e9b(0x171)](_0x414351,_0x22ad17,_0x105403,_0x3ddf48){const _0xe4927f=a2_0x2f7e9b;if(_0x414351!==_0xe4927f(0x17b)&&!this[_0xe4927f(0x176)])return;const _0x255cc6=new Date()['toISOString'](),_0x393d51='['+_0x255cc6+_0xe4927f(0x168)+_0x414351[_0xe4927f(0x16d)]()+_0xe4927f(0x168)+_0x22ad17+']';console[_0xe4927f(0x17b)](_0x3ddf48?_0x393d51+'\x20'+_0x105403+'\x20'+JSON[_0xe4927f(0x164)](_0x3ddf48):_0x393d51+'\x20'+_0x105403),this[_0xe4927f(0x178)]?.[_0xe4927f(0x165)](JSON['stringify']({'ts':_0x255cc6,'level':_0x414351,'component':_0x22ad17,'msg':_0x105403,..._0x3ddf48&&{'data':_0x3ddf48}})+'\x0a');}}function a2_0x3c13(_0x2f0f6,_0x36ade3){_0x2f0f6=_0x2f0f6-0x164;const _0x316433=a2_0x3164();let _0x3c1338=_0x316433[_0x2f0f6];return _0x3c1338;}export const logger=new MorphLogger();
@@ -1 +1 @@
1
- (function(_0x2f4bc8,_0x5c10ae){const _0x488b84=a3_0x41b1,_0x35912f=_0x2f4bc8();while(!![]){try{const _0x10f8ae=parseInt(_0x488b84(0x100))/0x1*(parseInt(_0x488b84(0x112))/0x2)+-parseInt(_0x488b84(0x107))/0x3+-parseInt(_0x488b84(0x113))/0x4*(parseInt(_0x488b84(0x102))/0x5)+parseInt(_0x488b84(0x104))/0x6+-parseInt(_0x488b84(0x115))/0x7*(parseInt(_0x488b84(0x110))/0x8)+parseInt(_0x488b84(0x109))/0x9*(parseInt(_0x488b84(0x103))/0xa)+parseInt(_0x488b84(0x10f))/0xb*(parseInt(_0x488b84(0x10a))/0xc);if(_0x10f8ae===_0x5c10ae)break;else _0x35912f['push'](_0x35912f['shift']());}catch(_0x5650d4){_0x35912f['push'](_0x35912f['shift']());}}}(a3_0x5aaf,0xf1cbf));import a3_0x2acd69 from'path';function a3_0x41b1(_0x175090,_0x2a5d94){_0x175090=_0x175090-0xff;const _0x5aafcc=a3_0x5aaf();let _0x41b156=_0x5aafcc[_0x175090];return _0x41b156;}import a3_0x16b75e from'os';export function convertToWindowsPath(_0x576ea1){const _0x1ea20d=a3_0x41b1;if(_0x576ea1[_0x1ea20d(0x111)](_0x1ea20d(0x10b))){const _0x419be9=_0x576ea1[_0x1ea20d(0x10d)](0x5)[_0x1ea20d(0x10c)](),_0x4d70f0=_0x576ea1[_0x1ea20d(0x106)](0x6)[_0x1ea20d(0x10e)](/\//g,'\x5c');return _0x419be9+':'+_0x4d70f0;}if(_0x576ea1[_0x1ea20d(0x114)](/^\/[a-zA-Z]\//)){const _0x1c76c9=_0x576ea1[_0x1ea20d(0x10d)](0x1)['toUpperCase'](),_0x5dd9b7=_0x576ea1[_0x1ea20d(0x106)](0x2)['replace'](/\//g,'\x5c');return _0x1c76c9+':'+_0x5dd9b7;}if(_0x576ea1[_0x1ea20d(0x114)](/^[a-zA-Z]:/))return _0x576ea1[_0x1ea20d(0x10e)](/\//g,'\x5c');return _0x576ea1;}export function normalizePath(_0x4412dc){const _0x2d6cc3=a3_0x41b1;_0x4412dc=_0x4412dc[_0x2d6cc3(0x108)]()['replace'](/^["']|["']$/g,'');const _0x315209=_0x4412dc[_0x2d6cc3(0x111)]('/')&&!_0x4412dc['match'](/^\/mnt\/[a-z]\//i)&&!_0x4412dc[_0x2d6cc3(0x114)](/^\/[a-zA-Z]\//);if(_0x315209)return _0x4412dc[_0x2d6cc3(0x10e)](/\/+/g,'/')['replace'](/\/+$/,'');_0x4412dc=convertToWindowsPath(_0x4412dc);if(_0x4412dc[_0x2d6cc3(0x111)]('\x5c\x5c')){let _0x2c2c0b=_0x4412dc;_0x2c2c0b=_0x2c2c0b['replace'](/^\\{2,}/,'\x5c\x5c');const _0x2355c5=_0x2c2c0b[_0x2d6cc3(0xff)](0x2)['replace'](/\\\\/g,'\x5c');_0x4412dc='\x5c\x5c'+_0x2355c5;}else _0x4412dc=_0x4412dc[_0x2d6cc3(0x10e)](/\\\\/g,'\x5c');let _0x5f8117=a3_0x2acd69[_0x2d6cc3(0x116)](_0x4412dc);_0x4412dc[_0x2d6cc3(0x111)]('\x5c\x5c')&&!_0x5f8117['startsWith']('\x5c\x5c')&&(_0x5f8117='\x5c'+_0x5f8117);if(_0x5f8117[_0x2d6cc3(0x114)](/^[a-zA-Z]:/)){let _0x18d464=_0x5f8117[_0x2d6cc3(0x10e)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x18d464)&&(_0x18d464=_0x18d464['charAt'](0x0)[_0x2d6cc3(0x10c)]()+_0x18d464[_0x2d6cc3(0x106)](0x1)),_0x18d464;}return _0x5f8117[_0x2d6cc3(0x10e)](/\//g,'\x5c');}export function expandHome(_0xc6e9fd){const _0x4ee83e=a3_0x41b1;if(_0xc6e9fd[_0x4ee83e(0x111)]('~/')||_0xc6e9fd==='~')return a3_0x2acd69[_0x4ee83e(0x101)](a3_0x16b75e[_0x4ee83e(0x105)](),_0xc6e9fd[_0x4ee83e(0x106)](0x1));return _0xc6e9fd;}function a3_0x5aaf(){const _0x205bef=['322245nSOJEo','trim','36bYrkmy','5220oOzeKa','/mnt/','toUpperCase','charAt','replace','23584neAgXv','64KIsaVE','startsWith','397024SrXJnz','1156GrEcZF','match','895559vaKsyC','normalize','substring','6doqEWK','join','20665vMxWif','1598920tQEDfc','3314802SVXkCt','homedir','slice'];a3_0x5aaf=function(){return _0x205bef;};return a3_0x5aaf();}
1
+ (function(_0x4afbfa,_0x411b2d){const _0x1a8513=a3_0x4e6a,_0x190455=_0x4afbfa();while(!![]){try{const _0x30a827=-parseInt(_0x1a8513(0x190))/0x1*(parseInt(_0x1a8513(0x193))/0x2)+-parseInt(_0x1a8513(0x186))/0x3*(parseInt(_0x1a8513(0x192))/0x4)+parseInt(_0x1a8513(0x18e))/0x5*(parseInt(_0x1a8513(0x191))/0x6)+-parseInt(_0x1a8513(0x188))/0x7+-parseInt(_0x1a8513(0x185))/0x8+parseInt(_0x1a8513(0x18d))/0x9+parseInt(_0x1a8513(0x18c))/0xa;if(_0x30a827===_0x411b2d)break;else _0x190455['push'](_0x190455['shift']());}catch(_0x2771e0){_0x190455['push'](_0x190455['shift']());}}}(a3_0x3375,0xe705a));import a3_0x2c37ae from'path';import a3_0x35f55b from'os';export function convertToWindowsPath(_0x625263){const _0x5ed94b=a3_0x4e6a;if(_0x625263[_0x5ed94b(0x184)](_0x5ed94b(0x189))){const _0x215e77=_0x625263[_0x5ed94b(0x196)](0x5)['toUpperCase'](),_0x328e96=_0x625263[_0x5ed94b(0x197)](0x6)[_0x5ed94b(0x18b)](/\//g,'\x5c');return _0x215e77+':'+_0x328e96;}if(_0x625263[_0x5ed94b(0x18a)](/^\/[a-zA-Z]\//)){const _0x2c04e5=_0x625263['charAt'](0x1)[_0x5ed94b(0x198)](),_0x5305d0=_0x625263['slice'](0x2)[_0x5ed94b(0x18b)](/\//g,'\x5c');return _0x2c04e5+':'+_0x5305d0;}if(_0x625263[_0x5ed94b(0x18a)](/^[a-zA-Z]:/))return _0x625263[_0x5ed94b(0x18b)](/\//g,'\x5c');return _0x625263;}export function normalizePath(_0x5acb8c){const _0x58e9f5=a3_0x4e6a;_0x5acb8c=_0x5acb8c[_0x58e9f5(0x194)]()[_0x58e9f5(0x18b)](/^["']|["']$/g,'');const _0x58e14f=_0x5acb8c[_0x58e9f5(0x184)]('/')&&!_0x5acb8c[_0x58e9f5(0x18a)](/^\/mnt\/[a-z]\//i)&&!_0x5acb8c[_0x58e9f5(0x18a)](/^\/[a-zA-Z]\//);if(_0x58e14f)return _0x5acb8c['replace'](/\/+/g,'/')['replace'](/\/+$/,'');_0x5acb8c=convertToWindowsPath(_0x5acb8c);if(_0x5acb8c[_0x58e9f5(0x184)]('\x5c\x5c')){let _0x4f7cd3=_0x5acb8c;_0x4f7cd3=_0x4f7cd3[_0x58e9f5(0x18b)](/^\\{2,}/,'\x5c\x5c');const _0x2793b3=_0x4f7cd3['substring'](0x2)[_0x58e9f5(0x18b)](/\\\\/g,'\x5c');_0x5acb8c='\x5c\x5c'+_0x2793b3;}else _0x5acb8c=_0x5acb8c['replace'](/\\\\/g,'\x5c');let _0x3572d4=a3_0x2c37ae[_0x58e9f5(0x18f)](_0x5acb8c);_0x5acb8c[_0x58e9f5(0x184)]('\x5c\x5c')&&!_0x3572d4['startsWith']('\x5c\x5c')&&(_0x3572d4='\x5c'+_0x3572d4);if(_0x3572d4[_0x58e9f5(0x18a)](/^[a-zA-Z]:/)){let _0x333056=_0x3572d4[_0x58e9f5(0x18b)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x333056)&&(_0x333056=_0x333056[_0x58e9f5(0x196)](0x0)[_0x58e9f5(0x198)]()+_0x333056[_0x58e9f5(0x197)](0x1)),_0x333056;}return _0x3572d4[_0x58e9f5(0x18b)](/\//g,'\x5c');}function a3_0x3375(){const _0x5a9b1b=['startsWith','7886680mCVWFL','18sTOuWx','homedir','2940966JrNprN','/mnt/','match','replace','18769410IxTHMK','6828903iRoHpP','25XRjfbU','normalize','193sXHbZm','317766eWxfrr','123880evDrSS','3756OYlicc','trim','join','charAt','slice','toUpperCase'];a3_0x3375=function(){return _0x5a9b1b;};return a3_0x3375();}function a3_0x4e6a(_0x525b8d,_0x256756){_0x525b8d=_0x525b8d-0x184;const _0x3375e7=a3_0x3375();let _0x4e6a10=_0x3375e7[_0x525b8d];return _0x4e6a10;}export function expandHome(_0x38438a){const _0x4071cc=a3_0x4e6a;if(_0x38438a[_0x4071cc(0x184)]('~/')||_0x38438a==='~')return a3_0x2c37ae[_0x4071cc(0x195)](a3_0x35f55b[_0x4071cc(0x187)](),_0x38438a[_0x4071cc(0x197)](0x1));return _0x38438a;}
@@ -1 +1 @@
1
- function a4_0x5267(_0x1042f2,_0x19c663){_0x1042f2=_0x1042f2-0xc7;const _0x5bdeed=a4_0x5bde();let _0x526757=_0x5bdeed[_0x1042f2];return _0x526757;}(function(_0x56ad9a,_0x46d0b4){const _0x4fe317=a4_0x5267,_0x3070f2=_0x56ad9a();while(!![]){try{const _0x174f4a=-parseInt(_0x4fe317(0xcc))/0x1*(parseInt(_0x4fe317(0xd1))/0x2)+-parseInt(_0x4fe317(0xdc))/0x3*(parseInt(_0x4fe317(0xd4))/0x4)+-parseInt(_0x4fe317(0xca))/0x5*(parseInt(_0x4fe317(0xcd))/0x6)+parseInt(_0x4fe317(0xd6))/0x7+-parseInt(_0x4fe317(0xcb))/0x8*(-parseInt(_0x4fe317(0xd9))/0x9)+-parseInt(_0x4fe317(0xce))/0xa*(-parseInt(_0x4fe317(0xd3))/0xb)+parseInt(_0x4fe317(0xcf))/0xc;if(_0x174f4a===_0x46d0b4)break;else _0x3070f2['push'](_0x3070f2['shift']());}catch(_0x4482ea){_0x3070f2['push'](_0x3070f2['shift']());}}}(a4_0x5bde,0x3b15b));import a4_0x4587c4 from'path';export function isPathWithinAllowedDirectories(_0xe1dd56,_0x45357c){const _0x1f658a=a4_0x5267;if(typeof _0xe1dd56!==_0x1f658a(0xd0)||!Array[_0x1f658a(0xdb)](_0x45357c))return![];if(!_0xe1dd56||_0x45357c['length']===0x0)return![];if(_0xe1dd56[_0x1f658a(0xd5)]('\x00'))return![];let _0x86b745;try{_0x86b745=a4_0x4587c4['resolve'](a4_0x4587c4[_0x1f658a(0xc9)](_0xe1dd56));}catch{return![];}if(!a4_0x4587c4[_0x1f658a(0xc8)](_0x86b745))throw new Error(_0x1f658a(0xd2));return _0x45357c[_0x1f658a(0xd8)](_0x2673e6=>{const _0x205e3b=_0x1f658a;if(typeof _0x2673e6!=='string'||!_0x2673e6)return![];if(_0x2673e6['includes']('\x00'))return![];let _0x64a6d0;try{_0x64a6d0=a4_0x4587c4['resolve'](a4_0x4587c4[_0x205e3b(0xc9)](_0x2673e6));}catch{return![];}if(!a4_0x4587c4['isAbsolute'](_0x64a6d0))throw new Error(_0x205e3b(0xc7));if(_0x86b745===_0x64a6d0)return!![];if(_0x64a6d0===a4_0x4587c4[_0x205e3b(0xd7)])return _0x86b745[_0x205e3b(0xda)](a4_0x4587c4[_0x205e3b(0xd7)]);return _0x86b745[_0x205e3b(0xda)](_0x64a6d0+a4_0x4587c4[_0x205e3b(0xd7)]);});}function a4_0x5bde(){const _0x5ad2df=['235188SQcDcm','startsWith','isArray','207vBGtXJ','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','isAbsolute','normalize','344545UCbDwH','16YhynIl','436364MqnKkE','30bfVgdL','20bmVAhj','13637472xZFmcc','string','2aeIGsQ','Path\x20must\x20be\x20absolute\x20after\x20normalization','1173172yRIsIm','22956IRZOuj','includes','118209keDfwj','sep','some'];a4_0x5bde=function(){return _0x5ad2df;};return a4_0x5bde();}
1
+ function a4_0x54dd(){const _0x26efad=['4747588YcxqQY','some','5288565scnwaI','startsWith','normalize','sep','3865407qBzEBY','30QXVrmd','1503102XzxeKA','13527072yPwJNr','length','resolve','includes','606576WlGXEh','283804GSJQMZ','isAbsolute'];a4_0x54dd=function(){return _0x26efad;};return a4_0x54dd();}(function(_0x3c5716,_0x13a346){const _0x1bf052=a4_0x1c29,_0x50b4c8=_0x3c5716();while(!![]){try{const _0x24800a=parseInt(_0x1bf052(0x168))/0x1+parseInt(_0x1bf052(0x167))/0x2+parseInt(_0x1bf052(0x16c))/0x3+parseInt(_0x1bf052(0x16a))/0x4+-parseInt(_0x1bf052(0x161))/0x5*(parseInt(_0x1bf052(0x162))/0x6)+parseInt(_0x1bf052(0x160))/0x7+-parseInt(_0x1bf052(0x163))/0x8;if(_0x24800a===_0x13a346)break;else _0x50b4c8['push'](_0x50b4c8['shift']());}catch(_0x4406ec){_0x50b4c8['push'](_0x50b4c8['shift']());}}}(a4_0x54dd,0xda853));function a4_0x1c29(_0xc026fc,_0x10f352){_0xc026fc=_0xc026fc-0x15f;const _0x54ddea=a4_0x54dd();let _0x1c29fb=_0x54ddea[_0xc026fc];return _0x1c29fb;}import a4_0x417cf6 from'path';export function isPathWithinAllowedDirectories(_0x1fc7b2,_0x521baa){const _0x562bfc=a4_0x1c29;if(typeof _0x1fc7b2!=='string'||!Array['isArray'](_0x521baa))return![];if(!_0x1fc7b2||_0x521baa[_0x562bfc(0x164)]===0x0)return![];if(_0x1fc7b2[_0x562bfc(0x166)]('\x00'))return![];let _0x369bb9;try{_0x369bb9=a4_0x417cf6[_0x562bfc(0x165)](a4_0x417cf6[_0x562bfc(0x16e)](_0x1fc7b2));}catch{return![];}if(!a4_0x417cf6[_0x562bfc(0x169)](_0x369bb9))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x521baa[_0x562bfc(0x16b)](_0x470f03=>{const _0x3f55c5=_0x562bfc;if(typeof _0x470f03!=='string'||!_0x470f03)return![];if(_0x470f03[_0x3f55c5(0x166)]('\x00'))return![];let _0x421e35;try{_0x421e35=a4_0x417cf6[_0x3f55c5(0x165)](a4_0x417cf6[_0x3f55c5(0x16e)](_0x470f03));}catch{return![];}if(!a4_0x417cf6['isAbsolute'](_0x421e35))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x369bb9===_0x421e35)return!![];if(_0x421e35===a4_0x417cf6['sep'])return _0x369bb9[_0x3f55c5(0x16d)](a4_0x417cf6['sep']);return _0x369bb9['startsWith'](_0x421e35+a4_0x417cf6[_0x3f55c5(0x15f)]);});}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Reflex MCP tools: read production Reflex results back into a coding agent.
3
+ *
4
+ * Three read-only tools over the public Reflex API:
5
+ * - list_reflexes the built-in catalog + GET /v1/fine_tuning/jobs
6
+ * - reflex_summary GET /v1/reflex/traces, aggregated into per-model firing rates
7
+ * - get_reflex_traces GET /v1/reflex/traces, individual turns with labels + snippets
8
+ *
9
+ * Only trace-linked results are readable (turns shipped via `morphTracing()`);
10
+ * direct /v1/reflex/predict calls have no public read-back endpoint. Output is
11
+ * budgeted to stay under MCP clients' tool-output caps (~12k tokens).
12
+ */
13
+ import { z } from 'zod';
14
+ import { TracesClient } from '@morphllm/morphsdk/tools/traces';
15
+ import { ReflexClient } from '@morphllm/morphsdk/tools/reflex';
16
+ export declare const ListReflexesArgsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
17
+ export declare const ReflexSummaryArgsSchema: z.ZodObject<{
18
+ since_hours: z.ZodDefault<z.ZodNumber>;
19
+ max_events: z.ZodDefault<z.ZodNumber>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ since_hours: number;
22
+ max_events: number;
23
+ }, {
24
+ since_hours?: number | undefined;
25
+ max_events?: number | undefined;
26
+ }>;
27
+ export declare const GetReflexTracesArgsSchema: z.ZodObject<{
28
+ convo_id: z.ZodOptional<z.ZodString>;
29
+ model: z.ZodOptional<z.ZodString>;
30
+ reflex: z.ZodOptional<z.ZodString>;
31
+ label: z.ZodOptional<z.ZodString>;
32
+ limit: z.ZodDefault<z.ZodNumber>;
33
+ offset: z.ZodDefault<z.ZodNumber>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ limit: number;
36
+ offset: number;
37
+ convo_id?: string | undefined;
38
+ model?: string | undefined;
39
+ reflex?: string | undefined;
40
+ label?: string | undefined;
41
+ }, {
42
+ convo_id?: string | undefined;
43
+ model?: string | undefined;
44
+ reflex?: string | undefined;
45
+ label?: string | undefined;
46
+ limit?: number | undefined;
47
+ offset?: number | undefined;
48
+ }>;
49
+ export declare const LIST_REFLEXES_DESCRIPTION: string;
50
+ export declare const REFLEX_SUMMARY_DESCRIPTION: string;
51
+ export declare const GET_REFLEX_TRACES_DESCRIPTION: string;
52
+ export interface ReflexApi {
53
+ traces: TracesClient;
54
+ reflex: ReflexClient;
55
+ }
56
+ export declare function createReflexApi(apiKey: string, baseUrl?: string): ReflexApi;
57
+ export declare function runListReflexes(api: ReflexApi): Promise<string>;
58
+ export interface ReflexSummaryArgs {
59
+ since_hours: number;
60
+ max_events: number;
61
+ }
62
+ export declare function runReflexSummary(api: ReflexApi, args: ReflexSummaryArgs): Promise<string>;
63
+ export interface GetReflexTracesArgs {
64
+ convo_id?: string;
65
+ model?: string;
66
+ reflex?: string;
67
+ label?: string;
68
+ limit: number;
69
+ offset: number;
70
+ }
71
+ export declare function runGetReflexTraces(api: ReflexApi, args: GetReflexTracesArgs): Promise<string>;
@@ -0,0 +1 @@
1
+ const a5_0x3dfa15=a5_0x35eb;(function(_0x21e568,_0x3d7d92){const _0x178cc9=a5_0x35eb,_0x145e35=_0x21e568();while(!![]){try{const _0x207d91=-parseInt(_0x178cc9(0x15a))/0x1+-parseInt(_0x178cc9(0x16a))/0x2+parseInt(_0x178cc9(0x101))/0x3+-parseInt(_0x178cc9(0xe6))/0x4+-parseInt(_0x178cc9(0xe5))/0x5*(-parseInt(_0x178cc9(0x117))/0x6)+parseInt(_0x178cc9(0xcf))/0x7+-parseInt(_0x178cc9(0xc4))/0x8*(parseInt(_0x178cc9(0xe1))/0x9);if(_0x207d91===_0x3d7d92)break;else _0x145e35['push'](_0x145e35['shift']());}catch(_0x57f6d7){_0x145e35['push'](_0x145e35['shift']());}}}(a5_0x59ad,0xa143d));import{z}from'zod';import{MorphAPIClient}from'@morphllm/morphsdk';import{TracesClient}from'@morphllm/morphsdk/tools/traces';import{ReflexClient}from'@morphllm/morphsdk/tools/reflex';const OUTPUT_CHAR_BUDGET=0x9c40,SNIPPET_CHARS=0x190,TRACES_PAGE_SIZE=0x1f4,FILTER_SCAN_BOUND=0x1f4,TOP_CONVERSATIONS=0xa,TRACING_DOCS_URL='https://docs.morphllm.com/guides/reflex-tracing',DEFAULT_REFLEXES=[{'alias':a5_0x3dfa15(0x166),'classes':a5_0x3dfa15(0x138),'catches':'Prompt-injection\x20and\x20jailbreak\x20attempts'},{'alias':a5_0x3dfa15(0xfe),'classes':a5_0x3dfa15(0xf4),'catches':'Harassment\x20or\x20NSFW\x20content'},{'alias':'leaked-thinking','classes':a5_0x3dfa15(0xd1),'catches':a5_0x3dfa15(0x120)},{'alias':'stuck-in-a-loop','classes':'progressing\x20/\x20looping','catches':a5_0x3dfa15(0xcc)},{'alias':'incomplete-thought','classes':'complete\x20/\x20incomplete','catches':'User\x20sent\x20a\x20truncated\x20prompt'},{'alias':'user-frustrated','classes':a5_0x3dfa15(0xc3),'catches':'User\x20is\x20frustrated\x20with\x20the\x20agent'},{'alias':a5_0x3dfa15(0xc1),'classes':a5_0x3dfa15(0x148),'catches':a5_0x3dfa15(0x104)},{'alias':a5_0x3dfa15(0x13d),'classes':a5_0x3dfa15(0x168),'catches':a5_0x3dfa15(0x116)},{'alias':a5_0x3dfa15(0x12a),'classes':a5_0x3dfa15(0xdf),'catches':a5_0x3dfa15(0x16e)},{'alias':'domain','classes':a5_0x3dfa15(0x10a),'catches':a5_0x3dfa15(0xc9)},{'alias':a5_0x3dfa15(0x108),'classes':a5_0x3dfa15(0x152),'catches':a5_0x3dfa15(0xd6)}],POSITIVE_LABELS_BY_ALIAS={'jailbreak':[a5_0x3dfa15(0x166)],'guardrail':[a5_0x3dfa15(0x14f)],'user-frustrated':[a5_0x3dfa15(0x100)],'user-joy':[a5_0x3dfa15(0x10c)],'incomplete-thought':[a5_0x3dfa15(0xc5)],'difficulty':['hard','needs_info'],'ambiguity':[a5_0x3dfa15(0x124)],'leaked-thinking':[a5_0x3dfa15(0xe3)],'stuck-in-a-loop':[a5_0x3dfa15(0x123)],'health-emergency':[a5_0x3dfa15(0x111)]},CATEGORY_ALIASES=new Set(['domain']),BASELINE_LABELS=new Set(['benign',a5_0x3dfa15(0x160),a5_0x3dfa15(0xc8),a5_0x3dfa15(0x13c),a5_0x3dfa15(0x11d),'ok',a5_0x3dfa15(0xf8),a5_0x3dfa15(0x163),'no',a5_0x3dfa15(0xf7),'neutral',a5_0x3dfa15(0x13f),a5_0x3dfa15(0xe4),'easy',a5_0x3dfa15(0xd3),'allowed','pass',a5_0x3dfa15(0xec)]),NEGATION_PREFIX=/^(not|non|no)[ _-]/;function isFiringLabel(_0xa3362,_0x24e590){const _0x4d0ec6=a5_0x3dfa15;if(CATEGORY_ALIASES['has'](_0xa3362))return![];const _0x220841=_0x24e590[_0x4d0ec6(0x13b)]()[_0x4d0ec6(0xe9)](),_0x339647=POSITIVE_LABELS_BY_ALIAS[_0xa3362];if(_0x339647)return _0x339647[_0x4d0ec6(0x10e)](_0x220841);return!BASELINE_LABELS['has'](_0x220841)&&!NEGATION_PREFIX[_0x4d0ec6(0x128)](_0x220841);}function labelsOf(_0x563393){const _0x5b37c7=a5_0x3dfa15;if(_0x563393[_0x5b37c7(0x12c)][_0x5b37c7(0xf9)]>0x0)return _0x563393[_0x5b37c7(0x12c)];return _0x563393[_0x5b37c7(0x132)]?[_0x563393[_0x5b37c7(0x132)]]:[];}export const ListReflexesArgsSchema=z[a5_0x3dfa15(0xeb)]({});function a5_0x59ad(){const _0x5c482e=['toISOString','list','benign\x20/\x20jailbreak','label=','max_events','trim','none','ambiguity','Only\x20turns\x20where\x20a\x20Reflex\x20assigned\x20this\x20label,\x20e.g.\x20\x22frustrated\x22,\x20\x22looping\x22,\x20\x22jailbreak\x22.','complete','time','trimEnd','pendingResults',':\x20fired\x20','createdAt','slice','Look-back\x20window\x20in\x20hours\x20(default\x2024,\x20max\x20168).','\x20—\x20labels:\x20','joy\x20/\x20not_joy','startTime','Snippets\x20are\x20truncated;\x20page\x20with\x20limit/offset.','\x20traced\x20turns\x20across\x20','-\x20no\x20completed\x20Reflex\x20results\x20on\x20these\x20turns','jobs','(none)','true','\x20event=','classes','emergency\x20/\x20non-emergency','isNaN','toFixed','\x20still\x20in\x20progress)','completed','getTime','score','min','1113859MoRjBB','offset','get','running','\x20\x20reflexes:\x20','the\x20top\x20firing\x20conversations\x20to\x20drill\x20into\x20with\x20get_reflex_traces.\x20Use\x20this\x20before\x20','safe','add','hasMore','negative','\x20training\x20','reflexes','jailbreak','(jailbreak,\x20guardrail,\x20leaked-thinking,\x20stuck-in-a-loop,\x20user-frustrated,\x20...)\x20plus\x20any\x20','low\x20/\x20med\x20/\x20high','#\x20Traced\x20turns\x20(newest\x20first)','29492IqwUtU','-\x20none\x20yet\x20—\x20train\x20one:\x20https://docs.morphllm.com/sdk/components/reflexes/custom','outputText','succeeded','Prompt\x20difficulty,\x20for\x20model\x20routing','results\x20with\x20reflex_summary\x20or\x20get_reflex_traces.','default','startup\x20and\x20wrap\x20each\x20turn\x20in\x20begin()/finish()\x20—\x20','reflex_summary),\x20traced\x20model,\x20Reflex\x20name,\x20or\x20assigned\x20label\x20(e.g.\x20label:\x20\x22looping\x22).\x20','user-joy','h.\x0a','frustrated\x20/\x20not','88TiLaCg','incomplete','message','turnsWithResult','normal','Topic\x20of\x20a\x20request','convo_id=','convoId','Agent\x20blocked,\x20not\x20trying\x20new\x20things','models\x20or\x20providers\x20behave\x20in\x20production\x20(e.g.\x20a\x20canary\x20vs.\x20the\x20current\x20model)\x20—\x20plus\x20','eventId','4083996naHivn','number','clean\x20/\x20leaked','describe','progressing','sort','These\x20turns\x20have\x20no\x20Reflex\x20labels\x20yet.\x20Pass\x20evals:\x20{\x20user:\x20[...],\x20assistant:\x20[...]\x20}\x20to\x20','Patient-portal\x20message\x20needs\x20urgent\x20attention','begin()\x20so\x20every\x20turn\x20is\x20labeled\x20off\x20the\x20request\x20path\x20—\x20','firedTurns','(no\x20model)','\x20model=','labelCounts','join','List\x20the\x20Reflex\x20classifiers\x20available\x20on\x20this\x20Morph\x20account:\x20the\x2011\x20built-in\x20defaults\x20','-\x20(','easy\x20/\x20medium\x20/\x20hard','##\x20Top\x20firing\x20conversations','516753BleQli','reflexResults','leaked','low','5ttluYT','1956676oyPfzQ','max','\x20—\x20','toLowerCase','turns','object','healthy','Turns\x20to\x20return\x20(default\x2020,\x20max\x2050).','\x20\x20in:\x20\x20','model=','reflex=','optional','localeCompare','traces','true\x20/\x20false','Only\x20turns\x20classified\x20by\x20this\x20Reflex,\x20e.g.\x20\x22user-frustrated\x22.','Next:\x20reflex_summary\x20aggregates\x20recent\x20production\x20results;\x20get_reflex_traces\x20reads\x20individual\x20turns.','false','okay','length','labels','some','Only\x20turns\x20traced\x20from\x20this\x20LLM,\x20e.g.\x20\x22morph-glm52-744b\x22\x20or\x20your\x20previous\x20provider\x27s\x20model\x20name.','Scanned\x20','guardrail','data','frustrated','3279669flKyxY','size','string','User\x20is\x20delighted\x20with\x20the\x20agent','map','\x20had\x20a\x20firing\x20label.','model','health-emergency','filter','general\x20/\x20summary\x20/\x20coding\x20/\x20design\x20/\x20data','entries','joy','-\x20(could\x20not\x20list\x20custom\x20reflexes:\x20','includes','\x20model(s);\x20','reflex','emergency','status','convo_id','\x20traced\x20turns\x20(window\x20not\x20fully\x20covered\x20—\x20raise\x20max_events)\x20across\x20','limit','How\x20underspecified\x20a\x20prompt\x20is','7399506hzjvGW','Note:\x20direct\x20/v1/reflex/predict\x20calls\x20are\x20not\x20returned\x20here;\x20only\x20traced\x20turns\x20are.','push','Drill\x20in:\x20get_reflex_traces\x20with\x20{\x20convo_id\x20}\x20for\x20a\x20conversation,\x20or\x20{\x20model,\x20label\x20}\x20for\x20one\x20failure\x20mode.','[output\x20truncated\x20after\x20','\x20—\x20or\x20run\x20','clean','set','##\x20Custom\x20(trained\x20via\x20/v1/fine_tuning/jobs)','Agent\x20leaking\x20its\x20internal\x20thinking','\x20of\x20','hits','looping','high','fineTunedModel','Scanned\x20the\x20newest\x20','Loosen\x20the\x20filters,\x20or\x20run\x20reflex_summary\x20to\x20see\x20what\x20labels\x20exist.','test','Only\x20turns\x20from\x20this\x20conversation\x20(ids\x20appear\x20in\x20reflex_summary\x20output).','difficulty','\x20—\x20trained\x20','selected','Aggregate\x20recent\x20production\x20Reflex\x20results\x20from\x20traced\x20LLM\x20traffic\x20(morphTracing).\x20','replace','More\x20turns\x20available:\x20repeat\x20with\x20offset=','\x20results\x20still\x20pending)','\x20—\x20classes:\x20','label','(no\x20completed\x20results)','Reflexes\x20over\x20existing\x20traces\x20at\x20https://morphllm.com/dashboard/traces.','since_hours'];a5_0x59ad=function(){return _0x5c482e;};return a5_0x59ad();}export const ReflexSummaryArgsSchema=z[a5_0x3dfa15(0xeb)]({'since_hours':z[a5_0x3dfa15(0xd0)]()['int']()[a5_0x3dfa15(0x159)](0x1)['max'](0xa8)[a5_0x3dfa15(0x170)](0x18)[a5_0x3dfa15(0xd2)](a5_0x3dfa15(0x146)),'max_events':z[a5_0x3dfa15(0xd0)]()['int']()[a5_0x3dfa15(0x159)](0x1)[a5_0x3dfa15(0xe7)](0x7d0)[a5_0x3dfa15(0x170)](0x3e8)['describe']('Maximum\x20traced\x20turns\x20to\x20scan,\x20newest\x20first\x20(default\x201000).')});function a5_0x35eb(_0x369a4f,_0x2ddc7b){_0x369a4f=_0x369a4f-0xc0;const _0x59ad44=a5_0x59ad();let _0x35eb2d=_0x59ad44[_0x369a4f];return _0x35eb2d;}export const GetReflexTracesArgsSchema=z[a5_0x3dfa15(0xeb)]({'convo_id':z['string']()[a5_0x3dfa15(0xf1)]()['describe'](a5_0x3dfa15(0x129)),'model':z[a5_0x3dfa15(0x103)]()[a5_0x3dfa15(0xf1)]()[a5_0x3dfa15(0xd2)](a5_0x3dfa15(0xfc)),'reflex':z[a5_0x3dfa15(0x103)]()[a5_0x3dfa15(0xf1)]()[a5_0x3dfa15(0xd2)](a5_0x3dfa15(0xf5)),'label':z[a5_0x3dfa15(0x103)]()[a5_0x3dfa15(0xf1)]()[a5_0x3dfa15(0xd2)](a5_0x3dfa15(0x13e)),'limit':z['number']()['int']()['min'](0x1)['max'](0x32)['default'](0x14)['describe'](a5_0x3dfa15(0xed)),'offset':z[a5_0x3dfa15(0xd0)]()['int']()[a5_0x3dfa15(0x159)](0x0)['default'](0x0)[a5_0x3dfa15(0xd2)]('Skip\x20this\x20many\x20matching\x20turns\x20(pagination).')});export const LIST_REFLEXES_DESCRIPTION=a5_0x3dfa15(0xdd)+a5_0x3dfa15(0x167)+'custom\x20classifiers\x20trained\x20through\x20the\x20fine-tuning\x20API.\x20Reflexes\x20label\x20production\x20LLM\x20'+'traffic\x20per\x20turn.\x20Call\x20this\x20first\x20to\x20see\x20which\x20signals\x20exist,\x20then\x20pull\x20production\x20'+a5_0x3dfa15(0x16f);export const REFLEX_SUMMARY_DESCRIPTION=a5_0x3dfa15(0x12d)+'Returns\x20firing\x20rates\x20per\x20traced\x20model\x20per\x20Reflex\x20—\x20the\x20fastest\x20way\x20to\x20compare\x20how\x20two\x20'+a5_0x3dfa15(0xcd)+a5_0x3dfa15(0x15f)+'reading\x20individual\x20turns.';export const GET_REFLEX_TRACES_DESCRIPTION='Read\x20recent\x20traced\x20turns\x20from\x20production\x20with\x20their\x20Reflex\x20labels\x20and\x20input/output\x20'+'snippets,\x20newest\x20first.\x20Filter\x20by\x20convo_id\x20(drill\x20into\x20a\x20conversation\x20surfaced\x20by\x20'+a5_0x3dfa15(0xc0)+a5_0x3dfa15(0x14a);export function createReflexApi(_0x3d9ee6,_0x448977){const _0x155506=new MorphAPIClient({'apiKey':_0x3d9ee6,'baseURL':_0x448977});return{'traces':new TracesClient(_0x155506),'reflex':new ReflexClient(_0x155506)};}function parseTraceTime(_0x647b8b){const _0x3dfa79=a5_0x3dfa15;if(!_0x647b8b)return null;const _0x16f58a=_0x647b8b[_0x3dfa79(0x10e)]('T')?_0x647b8b:_0x647b8b[_0x3dfa79(0x12e)]('\x20','T'),_0x2bd5f3=new Date(/Z|[+-]\d\d:?\d\d$/[_0x3dfa79(0x128)](_0x16f58a)?_0x16f58a:_0x16f58a+'Z');return Number[_0x3dfa79(0x153)](_0x2bd5f3['getTime']())?null:_0x2bd5f3;}function truncate(_0x4091c1,_0x451b8d){const _0x2cb40c=a5_0x3dfa15,_0x1da1f8=_0x4091c1[_0x2cb40c(0x12e)](/\s+/g,'\x20')['trim']();return _0x1da1f8[_0x2cb40c(0xf9)]<=_0x451b8d?_0x1da1f8:_0x1da1f8[_0x2cb40c(0x145)](0x0,_0x451b8d)+'…';}function formatRate(_0xd044ec,_0x2c975e){const _0x23dc90=a5_0x3dfa15;if(_0x2c975e===0x0)return'—';return(_0xd044ec/_0x2c975e*0x64)[_0x23dc90(0x154)](0x1)+'%';}const NO_TRACES_MESSAGE='No\x20traced\x20turns\x20found.\x20Reflex\x20read-back\x20requires\x20tracing:\x20call\x20morphTracing()\x20once\x20at\x20'+(a5_0x3dfa15(0x171)+TRACING_DOCS_URL+'\x0a')+a5_0x3dfa15(0x118);export async function runListReflexes(_0xd3a885){const _0x5d2a03=a5_0x3dfa15,_0x5dcdc9=['#\x20Reflexes\x20on\x20this\x20account','','##\x20Built-in\x20(callable\x20by\x20every\x20account)'];for(const _0x247e11 of DEFAULT_REFLEXES){_0x5dcdc9[_0x5d2a03(0x119)]('-\x20'+_0x247e11['alias']+_0x5d2a03(0x131)+_0x247e11[_0x5d2a03(0x151)]+_0x5d2a03(0xe8)+_0x247e11['catches']);}_0x5dcdc9[_0x5d2a03(0x119)]('',_0x5d2a03(0x11f));try{const _0xccd47=await _0xd3a885[_0x5d2a03(0x110)][_0x5d2a03(0x14d)][_0x5d2a03(0x137)]({'limit':0x32}),_0x146ebc=_0xccd47[_0x5d2a03(0xff)][_0x5d2a03(0x109)](_0x374582=>_0x374582['status']===_0x5d2a03(0x16d)&&_0x374582[_0x5d2a03(0x125)]);_0x146ebc[_0x5d2a03(0xf9)]===0x0&&_0x5dcdc9[_0x5d2a03(0x119)](_0x5d2a03(0x16b));for(const _0x4c4ffd of _0x146ebc){const _0x395b44=new Date(_0x4c4ffd[_0x5d2a03(0x144)]*0x3e8)[_0x5d2a03(0x136)]()[_0x5d2a03(0x145)](0x0,0xa),_0x59e216=_0x4c4ffd[_0x5d2a03(0xfa)][_0x5d2a03(0xf9)]>0x0?_0x5d2a03(0x147)+_0x4c4ffd[_0x5d2a03(0xfa)]['join']('\x20/\x20'):'';_0x5dcdc9[_0x5d2a03(0x119)]('-\x20'+_0x4c4ffd['fineTunedModel']+_0x59e216+_0x5d2a03(0x12b)+_0x395b44);}const _0x5e2f21=_0xccd47['data'][_0x5d2a03(0x109)](_0x3b97fa=>_0x3b97fa[_0x5d2a03(0x112)]==='queued'||_0x3b97fa[_0x5d2a03(0x112)]===_0x5d2a03(0x15d)||_0x3b97fa[_0x5d2a03(0x112)]==='validating_files');_0x5e2f21[_0x5d2a03(0xf9)]>0x0&&_0x5dcdc9[_0x5d2a03(0x119)]('-\x20('+_0x5e2f21[_0x5d2a03(0xf9)]+_0x5d2a03(0x164)+(_0x5e2f21[_0x5d2a03(0xf9)]===0x1?'job':_0x5d2a03(0x14d))+_0x5d2a03(0x155));}catch(_0x5ea628){const _0x2ea55b=_0x5ea628 instanceof Error?_0x5ea628[_0x5d2a03(0xc6)]:String(_0x5ea628);_0x5dcdc9[_0x5d2a03(0x119)](_0x5d2a03(0x10d)+_0x2ea55b+')');}return _0x5dcdc9[_0x5d2a03(0x119)]('',_0x5d2a03(0xf6)),_0x5dcdc9[_0x5d2a03(0xdc)]('\x0a');}async function fetchTracesWindow(_0x407443,_0x4232cb,_0x3f0575){const _0x1771af=a5_0x3dfa15,_0x153095=Date['now']()-_0x4232cb*0x36ee80,_0xbfbbb5=[];let _0x4fb518=0x0;for(;;){const _0x38e25a=_0x3f0575-_0xbfbbb5[_0x1771af(0xf9)];if(_0x38e25a<=0x0)return{'events':_0xbfbbb5,'coveredWindow':![]};const _0x34d985=await _0x407443[_0x1771af(0xf3)][_0x1771af(0x137)]({'limit':Math[_0x1771af(0x159)](TRACES_PAGE_SIZE,_0x38e25a),'offset':_0x4fb518});for(const _0x4b7634 of _0x34d985[_0x1771af(0xff)]){const _0x461437=parseTraceTime(_0x4b7634[_0x1771af(0x149)]);if(_0x461437&&_0x461437[_0x1771af(0x157)]()<_0x153095)return{'events':_0xbfbbb5,'coveredWindow':!![]};_0xbfbbb5[_0x1771af(0x119)](_0x4b7634);}if(!_0x34d985[_0x1771af(0x162)]||_0x34d985[_0x1771af(0xff)][_0x1771af(0xf9)]===0x0)return{'events':_0xbfbbb5,'coveredWindow':!![]};_0x4fb518+=_0x34d985['data'][_0x1771af(0xf9)];}}export async function runReflexSummary(_0x41760d,_0xc83dce){const _0x3a27cf=a5_0x3dfa15,{events:_0xad8d9f,coveredWindow:_0x145911}=await fetchTracesWindow(_0x41760d,_0xc83dce[_0x3a27cf(0x135)],_0xc83dce[_0x3a27cf(0x13a)]);if(_0xad8d9f[_0x3a27cf(0xf9)]===0x0)return'No\x20traced\x20turns\x20in\x20the\x20last\x20'+_0xc83dce[_0x3a27cf(0x135)]+_0x3a27cf(0xc2)+NO_TRACES_MESSAGE;const _0x41149b=new Map(),_0x3cce27=new Map();let _0x168305=0x0,_0x5d8dcb=0x0;for(const _0x18338f of _0xad8d9f){const _0x52f73a=_0x18338f[_0x3a27cf(0x107)]||_0x3a27cf(0xd9);let _0x19f626=_0x41149b[_0x3a27cf(0x15c)](_0x52f73a);!_0x19f626&&(_0x19f626={'turns':0x0,'reflexes':new Map(),'pendingResults':0x0},_0x41149b['set'](_0x52f73a,_0x19f626));_0x19f626[_0x3a27cf(0xea)]+=0x1;const _0x252b0d=_0x18338f[_0x3a27cf(0xe2)][_0x3a27cf(0x109)](_0x4ada4d=>_0x4ada4d[_0x3a27cf(0x112)]===_0x3a27cf(0x156));_0x19f626[_0x3a27cf(0x142)]+=_0x18338f[_0x3a27cf(0xe2)]['filter'](_0x251f64=>_0x251f64[_0x3a27cf(0x112)]==='pending')[_0x3a27cf(0xf9)];if(_0x252b0d[_0x3a27cf(0xf9)]>0x0)_0x5d8dcb+=0x1;let _0x4c3df4=![];for(const _0x14531a of _0x252b0d){let _0x5a47a1=_0x19f626[_0x3a27cf(0x165)][_0x3a27cf(0x15c)](_0x14531a[_0x3a27cf(0x107)]);!_0x5a47a1&&(_0x5a47a1={'turnsWithResult':0x0,'firedTurns':0x0,'labelCounts':new Map()},_0x19f626[_0x3a27cf(0x165)]['set'](_0x14531a[_0x3a27cf(0x107)],_0x5a47a1));_0x5a47a1[_0x3a27cf(0xc7)]+=0x1;const _0x3b7077=labelsOf(_0x14531a);let _0x133494=![];for(const _0x2aaa59 of _0x3b7077['length']>0x0?_0x3b7077:[_0x3a27cf(0x14e)]){_0x5a47a1[_0x3a27cf(0xdb)]['set'](_0x2aaa59,(_0x5a47a1[_0x3a27cf(0xdb)][_0x3a27cf(0x15c)](_0x2aaa59)??0x0)+0x1);if(_0x2aaa59!==_0x3a27cf(0x14e)&&isFiringLabel(_0x14531a[_0x3a27cf(0x107)],_0x2aaa59)){_0x133494=!![];const _0x3e4ec3=_0x3cce27[_0x3a27cf(0x15c)](_0x18338f[_0x3a27cf(0xcb)])??{'time':_0x18338f['startTime'],'model':_0x52f73a,'hits':new Set()};_0x3e4ec3[_0x3a27cf(0x122)][_0x3a27cf(0x161)](_0x14531a[_0x3a27cf(0x107)]+':\x20'+_0x2aaa59),_0x3cce27[_0x3a27cf(0x11e)](_0x18338f['convoId'],_0x3e4ec3);}}_0x133494&&(_0x5a47a1[_0x3a27cf(0xd8)]+=0x1,_0x4c3df4=!![]);}if(_0x4c3df4)_0x168305+=0x1;}const _0x29567e=['#\x20Reflex\x20summary\x20—\x20last\x20'+_0xc83dce[_0x3a27cf(0x135)]+'h',_0x145911?_0x3a27cf(0xfd)+_0xad8d9f[_0x3a27cf(0xf9)]+_0x3a27cf(0x14b)+_0x41149b[_0x3a27cf(0x102)]+_0x3a27cf(0x10f)+_0x168305+_0x3a27cf(0x106):_0x3a27cf(0x126)+_0xad8d9f[_0x3a27cf(0xf9)]+_0x3a27cf(0x114)+_0x41149b['size']+_0x3a27cf(0x10f)+_0x168305+_0x3a27cf(0x106)];if(_0x5d8dcb===0x0)return _0x29567e[_0x3a27cf(0x119)]('',_0x3a27cf(0xd5)+(_0x3a27cf(0xd7)+TRACING_DOCS_URL+_0x3a27cf(0x11c))+_0x3a27cf(0x134)),_0x29567e[_0x3a27cf(0xdc)]('\x0a');const _0xf65572=[..._0x41149b[_0x3a27cf(0x10b)]()]['sort']((_0x4e17be,_0x1d9424)=>_0x1d9424[0x1]['turns']-_0x4e17be[0x1]['turns']);for(const [_0x453c13,_0x342258]of _0xf65572){_0x29567e['push']('','##\x20'+_0x453c13+_0x3a27cf(0xe8)+_0x342258[_0x3a27cf(0xea)]+'\x20turns');_0x342258['reflexes'][_0x3a27cf(0x102)]===0x0&&_0x29567e[_0x3a27cf(0x119)](_0x3a27cf(0x14c));const _0x130399=[..._0x342258[_0x3a27cf(0x165)][_0x3a27cf(0x10b)]()][_0x3a27cf(0xd4)]((_0x1da21c,_0x303c56)=>_0x303c56[0x1][_0x3a27cf(0xd8)]-_0x1da21c[0x1][_0x3a27cf(0xd8)]);for(const [_0x1774a6,_0x344b59]of _0x130399){const _0x296c74=[..._0x344b59['labelCounts']['entries']()][_0x3a27cf(0xd4)]((_0x4ea1bf,_0x232b87)=>_0x232b87[0x1]-_0x4ea1bf[0x1])[_0x3a27cf(0x105)](([_0xb99f4c,_0x28a099])=>_0xb99f4c+'\x20'+_0x28a099)[_0x3a27cf(0xdc)](',\x20');_0x29567e[_0x3a27cf(0x119)]('-\x20'+_0x1774a6+_0x3a27cf(0x143)+_0x344b59[_0x3a27cf(0xd8)]+'/'+_0x344b59['turnsWithResult']+'\x20'+('('+formatRate(_0x344b59[_0x3a27cf(0xd8)],_0x344b59[_0x3a27cf(0xc7)])+')\x20—\x20'+_0x296c74));}_0x342258[_0x3a27cf(0x142)]>0x0&&_0x29567e[_0x3a27cf(0x119)](_0x3a27cf(0xde)+_0x342258['pendingResults']+_0x3a27cf(0x130));}const _0x1684f1=[..._0x3cce27[_0x3a27cf(0x10b)]()][_0x3a27cf(0xd4)]((_0x1c7226,_0x3aa5a3)=>_0x3aa5a3[0x1][_0x3a27cf(0x122)][_0x3a27cf(0x102)]-_0x1c7226[0x1][_0x3a27cf(0x122)]['size']||_0x3aa5a3[0x1][_0x3a27cf(0x140)][_0x3a27cf(0xf2)](_0x1c7226[0x1][_0x3a27cf(0x140)]))[_0x3a27cf(0x145)](0x0,TOP_CONVERSATIONS);if(_0x1684f1['length']>0x0){_0x29567e[_0x3a27cf(0x119)]('',_0x3a27cf(0xe0));for(const [_0x1e64ed,_0x156959]of _0x1684f1){_0x29567e[_0x3a27cf(0x119)]('-\x20'+_0x1e64ed+_0x3a27cf(0xe8)+_0x156959[_0x3a27cf(0x140)]+_0x3a27cf(0xe8)+_0x156959[_0x3a27cf(0x107)]+_0x3a27cf(0xe8)+[..._0x156959[_0x3a27cf(0x122)]][_0x3a27cf(0xdc)](',\x20'));}_0x29567e[_0x3a27cf(0x119)]('',_0x3a27cf(0x11a));}return _0x29567e[_0x3a27cf(0xdc)]('\x0a');}function formatTraceEvent(_0x33ce3f){const _0x5cd6b6=a5_0x3dfa15,_0x3de378=_0x33ce3f[_0x5cd6b6(0xe2)][_0x5cd6b6(0x109)](_0x43a475=>_0x43a475['status']===_0x5cd6b6(0x156)),_0x71743e=_0x33ce3f['reflexResults'][_0x5cd6b6(0xf9)]-_0x3de378[_0x5cd6b6(0xf9)],_0x106e92=_0x3de378[_0x5cd6b6(0x105)](_0x7c6ab7=>{const _0x194991=_0x5cd6b6,_0x344371=labelsOf(_0x7c6ab7)[_0x194991(0xdc)](',\x20')||'(none)';return _0x7c6ab7[_0x194991(0x107)]+'='+_0x344371+'\x20('+_0x7c6ab7[_0x194991(0x158)][_0x194991(0x154)](0x2)+')';})[_0x5cd6b6(0xdc)](';\x20'),_0x578875=['['+_0x33ce3f[_0x5cd6b6(0x149)]+']\x20convo='+_0x33ce3f['convoId']+_0x5cd6b6(0x150)+_0x33ce3f[_0x5cd6b6(0xce)]+_0x5cd6b6(0xda)+(_0x33ce3f['model']||'(no\x20model)'),_0x5cd6b6(0x15e)+(_0x106e92||_0x5cd6b6(0x133))+(_0x71743e>0x0?'\x20—\x20'+_0x71743e+'\x20pending':'')];if(_0x33ce3f['inputText'])_0x578875[_0x5cd6b6(0x119)](_0x5cd6b6(0xee)+truncate(_0x33ce3f['inputText'],SNIPPET_CHARS));if(_0x33ce3f[_0x5cd6b6(0x16c)])_0x578875[_0x5cd6b6(0x119)]('\x20\x20out:\x20'+truncate(_0x33ce3f[_0x5cd6b6(0x16c)],SNIPPET_CHARS));return _0x578875['join']('\x0a');}export async function runGetReflexTraces(_0x489d30,_0xa4504a){const _0x31ee88=a5_0x3dfa15,_0x26b2cc=_0xa4504a['label']?.[_0x31ee88(0x13b)]()['toLowerCase'](),_0x335bce=Boolean(_0xa4504a[_0x31ee88(0x107)]||_0xa4504a[_0x31ee88(0x110)]||_0x26b2cc),_0x2db5bd=_0x20f14b=>{const _0x97a094=_0x31ee88;if(_0xa4504a[_0x97a094(0x107)]&&_0x20f14b[_0x97a094(0x107)]!==_0xa4504a[_0x97a094(0x107)])return![];if(_0xa4504a[_0x97a094(0x110)]&&!_0x20f14b[_0x97a094(0xe2)][_0x97a094(0xfb)](_0x4eef79=>_0x4eef79['model']===_0xa4504a['reflex']))return![];if(_0x26b2cc&&!_0x20f14b[_0x97a094(0xe2)][_0x97a094(0xfb)](_0x127d0e=>labelsOf(_0x127d0e)[_0x97a094(0xfb)](_0x147912=>_0x147912[_0x97a094(0xe9)]()===_0x26b2cc)))return![];return!![];};let _0x9f3ce=[],_0x441724=!![];if(!_0x335bce){const _0x32e3c0=await _0x489d30[_0x31ee88(0xf3)][_0x31ee88(0x137)]({'convoId':_0xa4504a[_0x31ee88(0x113)],'limit':_0xa4504a['limit'],'offset':_0xa4504a['offset']});_0x9f3ce=_0x32e3c0[_0x31ee88(0xff)],_0x441724=!_0x32e3c0[_0x31ee88(0x162)];}else{const _0x1e6c0d=_0xa4504a[_0x31ee88(0x15b)]+_0xa4504a[_0x31ee88(0x115)];let _0x54f8f0=0x0,_0x3d2d96=0x0,_0x283cb2=!![];while(_0x9f3ce[_0x31ee88(0xf9)]<_0x1e6c0d&&_0x283cb2&&_0x3d2d96<FILTER_SCAN_BOUND){const _0x3915fe=await _0x489d30[_0x31ee88(0xf3)]['list']({'convoId':_0xa4504a[_0x31ee88(0x113)],'limit':0x64,'offset':_0x54f8f0});for(const _0x2f646b of _0x3915fe[_0x31ee88(0xff)]){_0x3d2d96+=0x1;if(_0x2db5bd(_0x2f646b))_0x9f3ce['push'](_0x2f646b);}_0x283cb2=_0x3915fe[_0x31ee88(0x162)]&&_0x3915fe[_0x31ee88(0xff)][_0x31ee88(0xf9)]>0x0,_0x54f8f0+=_0x3915fe[_0x31ee88(0xff)][_0x31ee88(0xf9)];}_0x441724=!_0x283cb2,_0x9f3ce=_0x9f3ce[_0x31ee88(0x145)](_0xa4504a['offset'],_0xa4504a[_0x31ee88(0x15b)]+_0xa4504a['limit']);}const _0x244232=[_0xa4504a[_0x31ee88(0x113)]&&_0x31ee88(0xca)+_0xa4504a[_0x31ee88(0x113)],_0xa4504a[_0x31ee88(0x107)]&&_0x31ee88(0xef)+_0xa4504a[_0x31ee88(0x107)],_0xa4504a[_0x31ee88(0x110)]&&_0x31ee88(0xf0)+_0xa4504a[_0x31ee88(0x110)],_0xa4504a[_0x31ee88(0x132)]&&_0x31ee88(0x139)+_0xa4504a['label']]['filter'](Boolean)['join'](',\x20');if(_0x9f3ce[_0x31ee88(0xf9)]===0x0){if(_0x244232)return'No\x20traced\x20turns\x20match\x20'+_0x244232+(_0x441724?'':'\x20in\x20the\x20newest\x20'+FILTER_SCAN_BOUND+'\x20turns')+'.\x20'+_0x31ee88(0x127);return NO_TRACES_MESSAGE;}const _0x299c75=[_0x31ee88(0x169)+(_0x244232?_0x31ee88(0xe8)+_0x244232:''),''];let _0x2fbbb3=_0x299c75[_0x31ee88(0xdc)]('\x0a')['length'],_0x6e686a=0x0;for(const _0x269b24 of _0x9f3ce){const _0x173e6f=formatTraceEvent(_0x269b24);if(_0x2fbbb3+_0x173e6f[_0x31ee88(0xf9)]>OUTPUT_CHAR_BUDGET){_0x299c75['push'](_0x31ee88(0x11b)+_0x6e686a+_0x31ee88(0x121)+_0x9f3ce[_0x31ee88(0xf9)]+'\x20turns\x20—\x20narrow\x20with\x20convo_id/model/label\x20or\x20lower\x20limit]');break;}_0x299c75['push'](_0x173e6f,''),_0x2fbbb3+=_0x173e6f[_0x31ee88(0xf9)]+0x2,_0x6e686a+=0x1;}return _0x6e686a===_0x9f3ce[_0x31ee88(0xf9)]&&!_0x441724&&_0x299c75['push'](_0x31ee88(0x12f)+(_0xa4504a[_0x31ee88(0x15b)]+_0x9f3ce[_0x31ee88(0xf9)])+'.'),_0x299c75['join']('\x0a')[_0x31ee88(0x141)]();}
@@ -1 +1 @@
1
- (function(_0x4a3313,_0x341382){const _0x4c69c1=a5_0x4cae,_0x2b1128=_0x4a3313();while(!![]){try{const _0x3178fb=parseInt(_0x4c69c1(0x13b))/0x1*(-parseInt(_0x4c69c1(0x145))/0x2)+parseInt(_0x4c69c1(0x13a))/0x3*(parseInt(_0x4c69c1(0x14c))/0x4)+parseInt(_0x4c69c1(0x142))/0x5*(parseInt(_0x4c69c1(0x147))/0x6)+parseInt(_0x4c69c1(0x137))/0x7*(-parseInt(_0x4c69c1(0x138))/0x8)+parseInt(_0x4c69c1(0x143))/0x9+-parseInt(_0x4c69c1(0x146))/0xa*(parseInt(_0x4c69c1(0x14b))/0xb)+parseInt(_0x4c69c1(0x13c))/0xc*(-parseInt(_0x4c69c1(0x14e))/0xd);if(_0x3178fb===_0x341382)break;else _0x2b1128['push'](_0x2b1128['shift']());}catch(_0x2e653c){_0x2b1128['push'](_0x2b1128['shift']());}}}(a5_0x3d8e,0x1f1d8));import{promises as a5_0x4c099e}from'fs';function a5_0x3d8e(){const _0x33c442=['970aRsNvK','24uyklTy','slice','join','startsWith','resolve','realpath','305dcyiuv','2039310wBHZGc','push','440fleZGN','5160xzMYgm','18312BYdBiN','isDirectory','invalid\x20path\x20or\x20inaccessible','non-directory\x20root','660ATPBWE','522692odxbyU','uri','840086yQkjKQ','Skipping\x20invalid\x20directory:\x20','stat','7JKwOIo','339064cvYKYY','homedir','3tGDCTP'];a5_0x3d8e=function(){return _0x33c442;};return a5_0x3d8e();}import a5_0x284afc from'path';import a5_0x578116 from'os';import{normalizePath}from'./path-utils.js';function a5_0x4cae(_0x35d927,_0x5ad5bd){_0x35d927=_0x35d927-0x137;const _0x3d8e02=a5_0x3d8e();let _0x4cae9a=_0x3d8e02[_0x35d927];return _0x4cae9a;}import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x2960a6){const _0x37a74a=a5_0x4cae;try{const _0xff38f8=_0x2960a6[_0x37a74a(0x13f)]('file://')?_0x2960a6[_0x37a74a(0x13d)](0x7):_0x2960a6,_0xa54110=_0xff38f8['startsWith']('~/')||_0xff38f8==='~'?a5_0x284afc[_0x37a74a(0x13e)](a5_0x578116[_0x37a74a(0x139)](),_0xff38f8[_0x37a74a(0x13d)](0x1)):_0xff38f8,_0x31dfc4=a5_0x284afc[_0x37a74a(0x140)](_0xa54110),_0x2050aa=await a5_0x4c099e[_0x37a74a(0x141)](_0x31dfc4);return normalizePath(_0x2050aa);}catch{return null;}}function formatDirectoryError(_0x1f19a7,_0x236637,_0x90e300){const _0x3470e1=a5_0x4cae;if(_0x90e300)return'Skipping\x20'+_0x90e300+':\x20'+_0x1f19a7;const _0x38a65e=_0x236637 instanceof Error?_0x236637['message']:String(_0x236637);return _0x3470e1(0x14f)+_0x1f19a7+'\x20due\x20to\x20error:\x20'+_0x38a65e;}export async function getValidRootDirectories(_0x3f5afa){const _0x501c6f=a5_0x4cae,_0xc68329=[];for(const _0x15df94 of _0x3f5afa){const _0x57aaff=await parseRootUri(_0x15df94[_0x501c6f(0x14d)]);if(!_0x57aaff){logMcpStderr(formatDirectoryError(_0x15df94[_0x501c6f(0x14d)],undefined,_0x501c6f(0x149)));continue;}try{const _0x386249=await a5_0x4c099e[_0x501c6f(0x150)](_0x57aaff);_0x386249[_0x501c6f(0x148)]()?_0xc68329[_0x501c6f(0x144)](_0x57aaff):logMcpStderr(formatDirectoryError(_0x57aaff,undefined,_0x501c6f(0x14a)));}catch(_0x5d00d7){logMcpStderr(formatDirectoryError(_0x57aaff,_0x5d00d7));}}return _0xc68329;}
1
+ (function(_0x186619,_0x56d67f){const _0x386368=a6_0x4aec,_0x30dade=_0x186619();while(!![]){try{const _0x36a218=-parseInt(_0x386368(0x78))/0x1+-parseInt(_0x386368(0x77))/0x2*(-parseInt(_0x386368(0x7d))/0x3)+parseInt(_0x386368(0x81))/0x4+parseInt(_0x386368(0x76))/0x5+parseInt(_0x386368(0x83))/0x6+parseInt(_0x386368(0x85))/0x7*(-parseInt(_0x386368(0x70))/0x8)+-parseInt(_0x386368(0x72))/0x9;if(_0x36a218===_0x56d67f)break;else _0x30dade['push'](_0x30dade['shift']());}catch(_0x396433){_0x30dade['push'](_0x30dade['shift']());}}}(a6_0x2141,0x57a8e));import{promises as a6_0x2df279}from'fs';function a6_0x2141(){const _0x246987=['2354985waFBdY','uri','join','Skipping\x20invalid\x20directory:\x20','3034545cWtBaC','5938PcpHZV','624620bqRyPV','push','\x20due\x20to\x20error:\x20','file://','stat','111SkrRFU','message','slice','startsWith','1557304peTztm','realpath','2240112RICBKI','isDirectory','234101iPQxkL','non-directory\x20root','56efDdIg','invalid\x20path\x20or\x20inaccessible'];a6_0x2141=function(){return _0x246987;};return a6_0x2141();}import a6_0x3d5d6e from'path';function a6_0x4aec(_0x267e3a,_0x2df389){_0x267e3a=_0x267e3a-0x70;const _0x21410f=a6_0x2141();let _0x4aeceb=_0x21410f[_0x267e3a];return _0x4aeceb;}import a6_0xf448f0 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x9af9ff){const _0xedd06c=a6_0x4aec;try{const _0xed0715=_0x9af9ff['startsWith'](_0xedd06c(0x7b))?_0x9af9ff[_0xedd06c(0x7f)](0x7):_0x9af9ff,_0x371df3=_0xed0715[_0xedd06c(0x80)]('~/')||_0xed0715==='~'?a6_0x3d5d6e[_0xedd06c(0x74)](a6_0xf448f0['homedir'](),_0xed0715[_0xedd06c(0x7f)](0x1)):_0xed0715,_0x25f28b=a6_0x3d5d6e['resolve'](_0x371df3),_0x4c7102=await a6_0x2df279[_0xedd06c(0x82)](_0x25f28b);return normalizePath(_0x4c7102);}catch{return null;}}function formatDirectoryError(_0x5d6ada,_0x3804c7,_0x46bc24){const _0x5b526c=a6_0x4aec;if(_0x46bc24)return'Skipping\x20'+_0x46bc24+':\x20'+_0x5d6ada;const _0x261d07=_0x3804c7 instanceof Error?_0x3804c7[_0x5b526c(0x7e)]:String(_0x3804c7);return _0x5b526c(0x75)+_0x5d6ada+_0x5b526c(0x7a)+_0x261d07;}export async function getValidRootDirectories(_0x394127){const _0x60ca30=a6_0x4aec,_0x3615f0=[];for(const _0xb59527 of _0x394127){const _0x571342=await parseRootUri(_0xb59527[_0x60ca30(0x73)]);if(!_0x571342){logMcpStderr(formatDirectoryError(_0xb59527['uri'],undefined,_0x60ca30(0x71)));continue;}try{const _0x33fee9=await a6_0x2df279[_0x60ca30(0x7c)](_0x571342);_0x33fee9[_0x60ca30(0x84)]()?_0x3615f0[_0x60ca30(0x79)](_0x571342):logMcpStderr(formatDirectoryError(_0x571342,undefined,_0x60ca30(0x86)));}catch(_0x868936){logMcpStderr(formatDirectoryError(_0x571342,_0x868936));}}return _0x3615f0;}
@@ -8,6 +8,9 @@ export declare const TOOL_NAMES: {
8
8
  readonly EDIT_FILE: "edit_file";
9
9
  readonly CODEBASE_SEARCH: "codebase_search";
10
10
  readonly GITHUB_CODEBASE_SEARCH: "github_codebase_search";
11
+ readonly LIST_REFLEXES: "list_reflexes";
12
+ readonly REFLEX_SUMMARY: "reflex_summary";
13
+ readonly GET_REFLEX_TRACES: "get_reflex_traces";
11
14
  };
12
15
  export type ToolName = (typeof TOOL_NAMES)[keyof typeof TOOL_NAMES];
13
16
  export declare const ALL_TOOL_NAMES: readonly ToolName[];
@@ -1 +1 @@
1
- function a6_0x6800(){const _0x89c1ed=['171820sbBjwy','6532386uYutfX','121QVfgpa','11512278QeYXoH','github_codebase_search','18182DdAQFI','8RkmpUl','48tLvzzK','values','43kwixAx','517275NSviVk','3974499BaXSVq','2479680aUoGXJ'];a6_0x6800=function(){return _0x89c1ed;};return a6_0x6800();}const a6_0x1737b6=a6_0x7fa9;(function(_0x3cb4b4,_0x50d5cb){const _0x4c345a=a6_0x7fa9,_0x3b9c43=_0x3cb4b4();while(!![]){try{const _0x2e919a=parseInt(_0x4c345a(0xa8))/0x1*(parseInt(_0x4c345a(0xa4))/0x2)+parseInt(_0x4c345a(0xaa))/0x3+parseInt(_0x4c345a(0xab))/0x4+parseInt(_0x4c345a(0xa9))/0x5*(parseInt(_0x4c345a(0xa6))/0x6)+-parseInt(_0x4c345a(0xad))/0x7+-parseInt(_0x4c345a(0xa5))/0x8*(parseInt(_0x4c345a(0xa2))/0x9)+parseInt(_0x4c345a(0xac))/0xa*(-parseInt(_0x4c345a(0xae))/0xb);if(_0x2e919a===_0x50d5cb)break;else _0x3b9c43['push'](_0x3b9c43['shift']());}catch(_0x7f4939){_0x3b9c43['push'](_0x3b9c43['shift']());}}}(a6_0x6800,0xba06c));function a6_0x7fa9(_0x5f344a,_0x3089dc){_0x5f344a=_0x5f344a-0xa2;const _0x6800dc=a6_0x6800();let _0x7fa9dd=_0x6800dc[_0x5f344a];return _0x7fa9dd;}export const TOOL_NAMES={'EDIT_FILE':'edit_file','CODEBASE_SEARCH':'codebase_search','GITHUB_CODEBASE_SEARCH':a6_0x1737b6(0xa3)};export const ALL_TOOL_NAMES=Object[a6_0x1737b6(0xa7)](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
1
+ function a7_0x1c30(_0x167f54,_0x2c85c8){_0x167f54=_0x167f54-0x77;const _0x533218=a7_0x5332();let _0x1c3096=_0x533218[_0x167f54];return _0x1c3096;}const a7_0x831b8f=a7_0x1c30;function a7_0x5332(){const _0x4a52b2=['github_codebase_search','8QftZVf','get_reflex_traces','255286FnVlGI','list_reflexes','329xJcufU','16811652LnFYKG','850XkMhSR','codebase_search','reflex_summary','33438nbbDEe','164cQOLuz','963OLodxG','65LpKlVZ','27800JBdRZs','edit_file','104360wDCsDt','65973USlaeT','2478612DShtdo'];a7_0x5332=function(){return _0x4a52b2;};return a7_0x5332();}(function(_0x199c36,_0x2a0e39){const _0x5ce603=a7_0x1c30,_0x589565=_0x199c36();while(!![]){try{const _0x5a8c24=parseInt(_0x5ce603(0x7f))/0x1*(parseInt(_0x5ce603(0x7d))/0x2)+parseInt(_0x5ce603(0x7a))/0x3*(-parseInt(_0x5ce603(0x87))/0x4)+parseInt(_0x5ce603(0x83))/0x5*(-parseInt(_0x5ce603(0x86))/0x6)+-parseInt(_0x5ce603(0x81))/0x7*(-parseInt(_0x5ce603(0x77))/0x8)+-parseInt(_0x5ce603(0x88))/0x9*(parseInt(_0x5ce603(0x79))/0xa)+parseInt(_0x5ce603(0x82))/0xb+-parseInt(_0x5ce603(0x7b))/0xc*(-parseInt(_0x5ce603(0x89))/0xd);if(_0x5a8c24===_0x2a0e39)break;else _0x589565['push'](_0x589565['shift']());}catch(_0x3cedd7){_0x589565['push'](_0x589565['shift']());}}}(a7_0x5332,0xbe657));export const TOOL_NAMES={'EDIT_FILE':a7_0x831b8f(0x78),'CODEBASE_SEARCH':a7_0x831b8f(0x84),'GITHUB_CODEBASE_SEARCH':a7_0x831b8f(0x7c),'LIST_REFLEXES':a7_0x831b8f(0x80),'REFLEX_SUMMARY':a7_0x831b8f(0x85),'GET_REFLEX_TRACES':a7_0x831b8f(0x7e)};export const ALL_TOOL_NAMES=Object['values'](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.203",
3
+ "version": "0.8.204",
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)",