MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / sideQuery

Function sideQuery

source code/utils/sideQuery.ts:109–224  ·  view source on GitHub ↗
(opts: SideQueryOptions)

Source from the content-addressed store, hash-verified

107 * await sideQuery({ querySource: 'model_validation', model, max_tokens: 1, messages: [{ role: 'user', content: 'Hi' }] })
108 */
109export async function sideQuery(opts: SideQueryOptions): Promise<BetaMessage> {
110 const {
111 model,
112 system,
113 messages,
114 tools,
115 tool_choice,
116 output_format,
117 max_tokens = 1024,
118 maxRetries = 2,
119 signal,
120 skipSystemPromptPrefix,
121 temperature,
122 thinking,
123 stop_sequences,
124 } = opts
125
126 const client = await getAnthropicClient({
127 maxRetries,
128 model,
129 source: 'side_query',
130 })
131 const betas = [...getModelBetas(model)]
132 // Add structured-outputs beta if using output_format and provider supports it
133 if (
134 output_format &&
135 modelSupportsStructuredOutputs(model) &&
136 !betas.includes(STRUCTURED_OUTPUTS_BETA_HEADER)
137 ) {
138 betas.push(STRUCTURED_OUTPUTS_BETA_HEADER)
139 }
140
141 // Extract first user message text for fingerprint
142 const messageText = extractFirstUserMessageText(messages)
143
144 // Compute fingerprint for OAuth attribution
145 const fingerprint = computeFingerprint(messageText, MACRO.VERSION)
146 const attributionHeader = getAttributionHeader(fingerprint)
147
148 // Build system as array to keep attribution header in its own block
149 // (prevents server-side parsing from including system content in cc_entrypoint)
150 const systemBlocks: TextBlockParam[] = [
151 attributionHeader ? { type: 'text', text: attributionHeader } : null,
152 // Skip CLI system prompt prefix for internal classifiers that provide their own prompt
153 ...(skipSystemPromptPrefix
154 ? []
155 : [
156 {
157 type: 'text' as const,
158 text: getCLISyspromptPrefix({
159 isNonInteractive: false,
160 hasAppendSystemPrompt: false,
161 }),
162 },
163 ]),
164 ...(Array.isArray(system)
165 ? system
166 : system

Callers 8

agenticSessionSearchFunction · 0.85
classifyYoloActionXmlFunction · 0.85
classifyYoloActionFunction · 0.85
validateModelFunction · 0.85
createChromeContextFunction · 0.85
autoModeCritiqueHandlerFunction · 0.85
selectRelevantMemoriesFunction · 0.85

Calls 12

getAnthropicClientFunction · 0.85
computeFingerprintFunction · 0.85
getAttributionHeaderFunction · 0.85
getCLISyspromptPrefixFunction · 0.85
getAPIMetadataFunction · 0.85
logEventFunction · 0.85
createMethod · 0.65

Tested by

no test coverage detected