| 4652 | 1. First: ToolSearch with query "select:mcp__claude-in-chrome__tabs_context_mcp" |
| 4653 | 2. Then: Call mcp__claude-in-chrome__tabs_context_mcp`,_fK='**Browser Automation**: Chrome browser tools are available via the "claude-in-chrome" skill. CRITICAL: Before using any mcp__claude-in-chrome__* tools, invoke the skill by calling the Skill tool with skill: "claude-in-chrome". The skill provides browser automation instructions and enables the tools.';function YfK(q){if(H17=q,q&&N18.length>0)for(let K of N18.splice(0))q(K)}function J17(q){if(H17)H17(q);else if(N18.push(q),N18.length>z_Y)N18.shift()}function qB8(q){if(__Y.includes(q))return!0;return zfK&&Gh.includes(q)}function M17(q,K,_){if(!qB8(_))return;J17({type:"started",hookId:q,hookName:K,hookEvent:_})}function Y_Y(q){if(!qB8(q.hookEvent))return;J17({type:"progress",...q})}function KB8(q){if(!qB8(q.hookEvent))return()=>{};let K="",_=setInterval(()=>{q.getOutput().then(({stdout:z,stderr:Y,output:$})=>{if($===K)return;K=$,Y_Y({hookId:q.hookId,hookName:q.hookName,hookEvent:q.hookEvent,stdout:z,stderr:Y,output:$})})},q.intervalMs??1000);return _.unref(),()=>clearInterval(_)}function i0(q){let K=q.stdout||q.stderr||q.output;if(K)N(`Hook ${q.hookName} (${q.hookEvent}) ${q.outcome}: |
| 4654 | ${K}`);if(!qB8(q.hookEvent))return;J17({type:"response",...q})}function $fK(q){zfK=q}var __Y,z_Y=100,N18,H17=null,zfK=!1;var y18=y(()=>{qK1();_8();__Y=["SessionStart","Setup"],N18=[]});function AfK({processId:q,hookId:K,asyncResponse:_,hookName:z,hookEvent:Y,command:$,shellCommand:A,toolName:O,pluginId:w}){let j=_.asyncTimeout||15000;N(`Hooks: Registering async hook ${q} (${z}) with timeout ${j}ms`);let H=KB8({hookId:K,hookName:z,hookEvent:Y,getOutput:async()=>{let J=oQ.get(q)?.shellCommand?.taskOutput;if(!J)return{stdout:"",stderr:"",output:""};let M=await J.getStdout(),X=J.getStderr();return{stdout:M,stderr:X,output:M+X}}});oQ.set(q,{processId:q,hookId:K,hookName:z,hookEvent:Y,toolName:O,pluginId:w,command:$,startTime:Date.now(),timeout:j,responseAttachmentSent:!1,shellCommand:A,stopProgressInterval:H})}async function X17(q,K,_){q.stopProgressInterval();let z=q.shellCommand?.taskOutput,Y=z?await z.getStdout():"",$=z?.getStderr()??"";q.shellCommand?.cleanup(),i0({hookId:q.hookId,hookName:q.hookName,hookEvent:q.hookEvent,output:Y+$,stdout:Y,stderr:$,exitCode:K,outcome:_})}async function OfK(){let q=[],K=oQ.size;N(`Hooks: Found ${K} total hooks in registry`);let _=Array.from(oQ.values()),z=await Promise.allSettled(_.map(async($)=>{let A=await $.shellCommand?.taskOutput.getStdout()??"",O=$.shellCommand?.taskOutput.getStderr()??"";if(N(`Hooks: Checking hook ${$.processId} (${$.hookName}) - attachmentSent: ${$.responseAttachmentSent}, stdout length: ${A.length}`),!$.shellCommand)return N(`Hooks: Hook ${$.processId} has no shell command, removing from registry`),$.stopProgressInterval(),{type:"remove",processId:$.processId};if(N(`Hooks: Hook shell status ${$.shellCommand.status}`),$.shellCommand.status==="killed")return N(`Hooks: Hook ${$.processId} is ${$.shellCommand.status}, removing from registry`),$.stopProgressInterval(),$.shellCommand.cleanup(),{type:"remove",processId:$.processId};if($.shellCommand.status!=="completed")return{type:"skip"};if($.responseAttachmentSent||!A.trim())return N(`Hooks: Skipping hook ${$.processId} - already delivered/sent or no stdout`),$.stopProgressInterval(),{type:"remove",processId:$.processId};let w=A.split(` |
| 4655 | `);N(`Hooks: Processing ${w.length} lines of stdout for ${$.processId}`);let H=(await $.shellCommand.result).code,J={};for(let M of w)if(M.trim().startsWith("{")){N(`Hooks: Found JSON line: ${M.trim().substring(0,100)}...`);try{let X=r8(M.trim());if(!("async"in X)){N(`Hooks: Found sync response from ${$.processId}: ${g6(X)}`),J=X;break}}catch{N(`Hooks: Failed to parse JSON from ${$.processId}: ${M.trim()}`)}}return $.responseAttachmentSent=!0,await X17($,H,H===0?"success":"error"),{type:"response",processId:$.processId,isSessionStart:$.hookEvent==="SessionStart",payload:{processId:$.processId,response:J,hookName:$.hookName,hookEvent:$.hookEvent,toolName:$.toolName,pluginId:$.pluginId,stdout:A,stderr:O,exitCode:H}}})),Y=!1;for(let $ of z){if($.status!=="fulfilled"){N(`Hooks: checkForAsyncHookResponses callback rejected: ${$.reason}`,{level:"error"});continue}let A=$.value;if(A.type==="remove")oQ.delete(A.processId);else if(A.type==="response"){if(q.push(A.payload),oQ.delete(A.processId),A.isSessionStart)Y=!0}}if(Y)N("Invalidating session env cache after SessionStart hook completed"),sE6();return N(`Hooks: checkForNewResponses returning ${q.length} responses`),q}function wfK(q){for(let K of q){let _=oQ.get(K);if(_&&_.responseAttachmentSent)N(`Hooks: Removing delivered hook ${K}`),_.stopProgressInterval(),oQ.delete(K)}}async function P17(){let q=Array.from(oQ.values());await Promise.all(q.map(async(K)=>{if(K.shellCommand?.status==="completed"){let _=await K.shellCommand.result;await X17(K,_.code,_.code===0?"success":"error")}else{if(K.shellCommand&&K.shellCommand.status!=="killed")K.shellCommand.kill();await X17(K,1,"cancelled")}})),oQ.clear()}var oQ;var _B8=y(()=>{_8();tE6();l8();y18();oQ=new Map});function zh6(q){return q.type==="user"&&!q.isMeta&&q.toolUseResult===void 0}async function jfK(q,K,_,z=[],Y=new Set){let $=(await Xp8(K,_)).filter((j)=>!Y.has(j.filePath));if($.length===0)return[];let A=await A_Y(q,$,_,z),O=new Map($.map((j)=>[j.filename,j]));return A.map((j)=>O.get(j)).filter((j)=>j!==void 0).map((j)=>({path:j.filePath,mtimeMs:j.mtimeMs}))}async function A_Y(q,K,_,z){let Y=new Set(K.map((O)=>O.filename)),$=Pp8(K),A=z.length>0?` |
| 4656 | |
| 4657 | Recently used tools: ${z.join(", ")}`:"";try{let w=(await CN({model:Av(),system:$_Y,skipSystemPromptPrefix:!0,messages:[{role:"user",content:`Query: ${q} |
| 4658 | |
| 4659 | Available memories: |
| 4660 | ${$}${A}`}],max_tokens:256,output_format:{type:"json_schema",schema:{type:"object",properties:{selected_memories:{type:"array",items:{type:"string"}}},required:["selected_memories"],additionalProperties:!1}},signal:_,querySource:"memdir_relevance"})).content.find((H)=>H.type==="text");if(!w||w.type!=="text")return[];return r8(w.text).selected_memories.filter((H)=>Y.has(H))}catch(O){if(_.aborted)return[];return N(`[memdir] selectRelevantMemories failed: ${d6(O)}`,{level:"warn"}),[]}}var $_Y=`You are selecting memories that will be useful to Claude Code as it processes a user's query. You will be given the user's query and a list of available memory files with their filenames and descriptions. |
| 4661 | |
| 4662 | Return a list of filenames for the memories that will clearly be useful to Claude Code as it processes the user's query (up to 5). Only include memories that you are certain will be helpful based on their name and description. |