MCPcopy Index your code
hub / github.com/ChinaSiro/claude-code-sourcemap / Cq7

Function Cq7

package/cli.js:5317–5317  ·  view source on GitHub ↗
(q=new Set)

Source from the content-addressed store, hash-verified

5315
5316"${z}"
5317
5318These instructions take priority over the general rules below. Make sure your updates align with these specific guidelines.`:"";return BOY(Y,{docContents:q,docPath:K,docTitle:_,customInstructions:$})}var kTK=y(()=>{m8();e7()});function VTK(){w78.clear()}function UOY(q){let K=q.match(gOY);if(!K||!K[1])return null;let _=K[1].trim(),z=K.index+K[0].length,$=q.slice(z).match(/^\s*\n(?:\s*\n)?(.+?)(?:\n|$)/);if($&&$[1]){let O=$[1].match(FOY);if(O&&O[1]){let w=O[1].trim();return{title:_,instructions:w}}}return{title:_}}function QOY(){return{agentType:"magic-docs",whenToUse:"Update Magic Docs",tools:[X4],model:"sonnet",source:"built-in",baseDir:"built-in",getSystemPrompt:()=>""}}async function dOY(q,K){let{messages:_,systemPrompt:z,userContext:Y,systemContext:$,toolUseContext:A}=K,O=gu(A.readFileState);O.delete(q.path);let w={...A,readFileState:O},j="";try{let P=(await i_.call({file_path:q.path},w)).data;if(P.type==="text")j=P.file.content}catch(X){if(e3(X)||X instanceof Error&&X.message.startsWith("File does not exist")){w78.delete(q.path);return}throw X}let H=UOY(j);if(!H){w78.delete(q.path);return}let J=await vTK(j,q.path,H.title,H.instructions),M=async(X,P)=>{if(X.name===X4&&typeof P==="object"&&P!==null&&"file_path"in P){let W=P.file_path;if(typeof W==="string"&&W===q.path)return{behavior:"allow",updatedInput:P}}return{behavior:"deny",message:`only ${X4} is allowed for ${q.path}`,decisionReason:{type:"other",reason:`only ${X4} is allowed`}}};for await(let X of iN({agentDefinition:QOY(),promptMessages:[U8({content:J})],toolUseContext:w,canUseTool:M,isAsync:!0,forkContextMessages:_,querySource:"magic_docs",override:{systemPrompt:z,userContext:Y,systemContext:$},availableTools:w.options.tools}));}async function NTK(){}var gOY,FOY,w78,Fsw;var Sq7=y(()=>{i46();$p();y8();NG();Br6();i1();kTK();gOY=/^#\s*MAGIC\s+DOC:\s*(.+)$/im,FOY=/^[_*](.+?)[_*]\s*$/m,w78=new Map;Fsw=TB(async function(q){let{messages:K,querySource:_}=q;if(_!=="repl_main_thread")return;if(o18(K))return;if(w78.size===0)return;for(let $ of Array.from(w78.values()))await dOY($,q)})});var bq7={};T8(bq7,{clearSessionCaches:()=>Cq7});function Cq7(q=new Set){let K=q.size>0;if(bO.cache.clear?.(),tw.cache.clear?.(),XI1.cache.clear?.(),Jk8.cache.clear?.(),fTK(),tQ(),!K)vj4();if(LH4(null),BX6(null),Hp(),$h6(),Xr6("session_start"),KC4(),G5K(),!K)N7K();if(h41(),DZK(),!K)DP4();ci8(q),CR7(),QYK(),N3K(),VTK(),AzK(),Promise.resolve().then(() => (Ze1(),AjK)).then(({clearWebFetchCache:_})=>_()),Promise.resolve().then(() => (Uk8(),jJ4)).then(({clearToolSearchDescriptionCache:_})=>_()),Promise.resolve().then(() => (SP(),s24)).then(({clearAgentDefinitionsCache:_})=>_()),Promise.resolve().then(() => (yO6(),Kj4)).then(({clearPromptCache:_})=>_())}var Dg8=y(()=>{v8();yA();yk6();jN();O78();yE6();vr();Q76();Ax8();G18();OL6();Sq7();Ga();lP();SG();wM();mZ();Hl();Ko();XI8()});var Iq7={};T8(Iq7,{clearConversation:()=>xq7});import{randomUUID as cOY}from"crypto";async function xq7({setMessages:q,readFileState:K,discoveredSkillNames:_,loadedNestedMemoryPaths:z,getAppState:Y,setAppState:$,setConversationId:A}){let O=H78();await J78("clear",{getAppState:Y,setAppState:$,signal:AbortSignal.timeout(O),timeoutMs:O});let w=ub6();if(w)d("tengu_cache_eviction_hint",{scope:"conversation_clear",last_request_id:w});let j=new Set,H=[],J=(P)=>("isBackgrounded"in P)&&P.isBackgrounded===!1;if(Y)for(let P of Object.values(Y().tasks)){if(J(P))continue;if(EJ(P))j.add(P.agentId),H.push(P);else if(xH(P))j.add(P.identity.agentId)}if(q(()=>[]),A)A(cOY());if(Cq7(j),QO(r1()),K.clear(),_?.clear(),z?.clear(),$)$((P)=>{let W={};for(let[D,f]of Object.entries(P.tasks)){if(!J(f)){W[D]=f;continue}try{if(f.status==="running"){if(sv(f)){if(f.shellCommand?.kill(),f.shellCommand?.cleanup(),f.cleanupTimeoutId)clearTimeout(f.cleanupTimeoutId)}if("abortController"in f)f.abortController?.abort();if("unregisterCleanup"in f)f.unregisterCleanup?.()}}catch(G){H6(G)}Zw(D)}return{...P,tasks:W,attribution:yV6(),standaloneAgentContext:void 0,fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:P.mcp.pluginReconnectKey}}});C5K(),j78(),un8({setCurrentAsParent:!0}),await mb();for(let P of H){if(P.status!=="running")continue;zH6(P.id,c0(pO(P.agentId)))}let M=n2();if(M)Oy(M);let X=await xD("clear");if(X.length>0)q(()=>X)}var fg8=y(()=>{v8();k8();gP();M0();xr();y$();E8();SJ();tN();JK6();_K();Ij();d0();Dg8()});var ETK={};T8(ETK,{call:()=>lOY});var lOY=async(q,K)=>{return await xq7(K),{type:"text",value:""}};var LTK=y(()=>{fg8()});var nOY,Zg8;var RTK=y(()=>{nOY={type:"local",name:"clear",description:"Clear conversation history and free up context",aliases:["reset","new"],supportsNonInteractive:!1,load:()=>Promise.resolve().then(() => (LTK(),ETK))},Zg8=nOY});var hTK={};T8(hTK,{call:()=>rOY});async function rOY(q,K,_){if($Y())return q("Cannot set color: This session is a swarm teammate. Teammate colors are assigned by the team leader.",{display:"system"}),null;if(!_||_.trim()===""){let A=GJ.join(", ");return q(`Please provide a color. Available colors: ${A}, default`,{display:"system"}),null}let z=_.trim().toLowerCase();if(iOY.includes(z)){let A=N8(),O=Y$();return await Gg8(A,"default",O),K.setAppState((w)=>({...w,standaloneAgentContext:{...w.standaloneAgentContext,name:w.standaloneAgentContext?.name??"",color:void 0}})),q("Session color reset to default",{display:"system"}),null}if(!GJ.includes(z)){let A=GJ.join(", ");return q(`Invalid color "${z}". Available colors: ${A}, default`,{display:"system"}),null}let Y=N8(),$=Y$();return await Gg8(Y,z,$),K.setAppState((A)=>({...A,standaloneAgentContext:{...A.standaloneAgentContext,name:A.standaloneAgentContext?.name??"",color:z}})),q(`Session color set to: ${z}`,{display:"system"}),null}var iOY;var STK=y(()=>{v8();$0();_K();AY();iOY=["default","reset","none","gray","grey"]});var oOY,uq7;var CTK=y(()=>{oOY={type:"local-jsx",name:"color",description:"Set the prompt bar color for this session",immediate:!0,argumentHint:"<color|default>",load:()=>Promise.resolve().then(() => (STK(),hTK))},uq7=oOY});function aOY(){let{commit:q}=dR6();return`${""}## Context
5319
5320- Current git status: !\`git status\`

Callers 1

xq7Function · 0.85

Calls 15

fTKFunction · 0.85
tQFunction · 0.85
vj4Function · 0.85
LH4Function · 0.85
BX6Function · 0.85
HpFunction · 0.85
$h6Function · 0.85
Xr6Function · 0.85
KC4Function · 0.85
G5KFunction · 0.85
N7KFunction · 0.85
h41Function · 0.85

Tested by

no test coverage detected