MCPcopy Create free account
hub / github.com/codeaashu/claude-code / buildDiffableContent

Function buildDiffableContent

src/services/api/promptCacheBreakDetection.ts:206–222  ·  view source on GitHub ↗
(
  system: TextBlockParam[],
  tools: BetaToolUnion[],
  model: string,
)

Source from the content-addressed store, hash-verified

204}
205
206function buildDiffableContent(
207 system: TextBlockParam[],
208 tools: BetaToolUnion[],
209 model: string,
210): string {
211 const systemText = system.map(b => b.text).join('\n\n')
212 const toolDetails = tools
213 .map(t => {
214 if (!('name' in t)) return 'unknown'
215 const desc = 'description' in t ? t.description : ''
216 const schema = 'input_schema' in t ? jsonStringify(t.input_schema) : ''
217 return `${t.name}\n description: ${desc}\n input_schema: ${schema}`
218 })
219 .sort()
220 .join('\n\n')
221 return `Model: ${model}\n\n=== System Prompt ===\n\n${systemText}\n\n=== Tools (${tools.length}) ===\n\n${toolDetails}\n`
222}
223
224/** Extended tracking snapshot — everything that could affect the server-side
225 * cache key that we can observe from the client. All fields are optional so

Callers 1

lazyDiffableContentFunction · 0.85

Calls 1

jsonStringifyFunction · 0.85

Tested by

no test coverage detected