(id: string)
| 17 | * @returns A normalized 9-character alphanumeric ID compatible with Mistral |
| 18 | */ |
| 19 | export function normalizeMistralToolCallId(id: string): string { |
| 20 | // Extract only alphanumeric characters |
| 21 | const alphanumeric = id.replace(/[^a-zA-Z0-9]/g, "") |
| 22 | |
| 23 | // Take first 9 characters, or pad with zeros if shorter |
| 24 | if (alphanumeric.length >= 9) { |
| 25 | return alphanumeric.slice(0, 9) |
| 26 | } |
| 27 | |
| 28 | // Pad with zeros to reach 9 characters |
| 29 | return alphanumeric.padEnd(9, "0") |
| 30 | } |
| 31 | |
| 32 | export type MistralMessage = |
| 33 | | (SystemMessage & { role: "system" }) |
no test coverage detected