( system: TextBlockParam[], tools: BetaToolUnion[], model: string, )
| 204 | } |
| 205 | |
| 206 | function 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 |
no test coverage detected