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

Function KMz

package/cli.js:2000–2003  ·  view source on GitHub ↗
(q)

Source from the content-addressed store, hash-verified

1998
1999<user_claude_md>
2000${q}
2001</user_claude_md>`,cache_control:pU({querySource:"auto_mode"})}]}}async function KMz(q){let K=aJz(),_=ob4.replace("<permissions_template>",()=>K?DF1:oJz),z=Np6(),Y=!1,$=!1,A=[...[],...z?.allow??[]],O=[...[],...[],...z?.soft_deny??[]],w=A.length?A.map((J)=>`- ${J}`).join(`
2002`):void 0,j=O.length?O.map((J)=>`- ${J}`).join(`
2003`):void 0,H=z?.environment?.length?z.environment.map((J)=>`- ${J}`).join(`
2004`):void 0;return _.replace(/<user_allow_rules_to_replace>([\s\S]*?)<\/user_allow_rules_to_replace>/,(J,M)=>w??M).replace(/<user_deny_rules_to_replace>([\s\S]*?)<\/user_deny_rules_to_replace>/,(J,M)=>j??M).replace(/<user_environment_to_replace>([\s\S]*?)<\/user_environment_to_replace>/,(J,M)=>H??M)}function zx4(q){return q.replace(/<thinking>[\s\S]*?<\/thinking>/g,"").replace(/<thinking>[\s\S]*$/,"")}function Qb4(q){let K=[...zx4(q).matchAll(/<block>(yes|no)\b(<\/block>)?/gi)];if(K.length===0)return null;return K[0][1].toLowerCase()==="yes"}function db4(q){let K=[...zx4(q).matchAll(/<reason>([\s\S]*?)<\/reason>/g)];if(K.length===0)return null;return K[0][1].trim()}function YMz(q){let K=/<thinking>([\s\S]*?)<\/thinking>/.exec(q);return K?K[1].trim():null}function cb4(q){return{inputTokens:q.usage.input_tokens,outputTokens:q.usage.output_tokens,cacheReadInputTokens:q.usage.cache_read_input_tokens??0,cacheCreationInputTokens:q.usage.cache_creation_input_tokens??0}}function WF1(q){return q._request_id??void 0}function $Mz(q,K){return{inputTokens:q.inputTokens+K.inputTokens,outputTokens:q.outputTokens+K.outputTokens,cacheReadInputTokens:q.cacheReadInputTokens+K.cacheReadInputTokens,cacheCreationInputTokens:q.cacheCreationInputTokens+K.cacheCreationInputTokens}}function AMz(q){let _=["## Output Format","","If the action should be blocked:","<block>yes</block><reason>one short sentence</reason>","","If the action should be allowed:","<block>no</block>","","Do NOT include a <reason> tag when the action is allowed.",'Your ENTIRE response MUST begin with <block>. Do NOT output any analysis, reasoning, or commentary before <block>. No "Looking at..." or similar preamble.'].join(`
2005`);return q.replace("Use the classify_result tool to report your classification.",_)}function Yx4(q){return[!1,0]}async function OMz(q,K,_,z,Y,$,A,O,w){let j=w==="both"?"xml_2stage":w==="fast"?"xml_fast":"xml_thinking",H=AMz(K),J=[{type:"text",text:H,cache_control:pU({querySource:"auto_mode"})}],M,X,P,W,D,f=Date.now(),[G,Z]=Yx4(Y),T=[{type:"text",text:`<transcript>
2006`},...z,{type:"text",text:`</transcript>

Callers 1

kL8Function · 0.85

Calls 4

aJzFunction · 0.85
Np6Function · 0.85
replaceMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected