(text: string)
| 50 | * or vision-analyze them. Mirrors Hermes's convert_base64_images_to_links. PURE. |
| 51 | */ |
| 52 | export function stripBase64Images(text: string): string { |
| 53 | return text.replace(/!\[([^\]]*)\]\(\s*data:image\/[^;]+;base64,[^)]*\)/gi, (_m, alt) => `[IMAGE${alt ? `: ${String(alt).trim()}` : ''}]`); |
| 54 | } |
| 55 | |
| 56 | /** Hermes's positional fallback: a head+tail window (~75/25), snapped to line boundaries. PURE. */ |
| 57 | export function headTailWindow(text: string, budget: number): { content: string; keptChars: number } { |
no outgoing calls
no test coverage detected