Add example_system_prompts/ (prose, speeches, coding) and matching example_user_prompts/ (four user prompts per domain, one file each so they run directly via --prompt-file), plus a README mapping the pairs and the run command against the default model. Also refine the three system prompts: separate narrative register from character speech and add a length default (prose); add a duration→word-count rule, spoken-language guidance, a no-invented-evidence rule, and a salutation note (speeches); fix the mangled numbered list and add a language default, a no-invented-APIs rule, and clearer output ordering (coding). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
727 B
727 B
Implementiere in TypeScript eine typsichere, wiederverwendbare Retry-Funktion retry mit exponentiellem Backoff und Jitter.
Anforderungen:
- Generisch über den Rückgabetyp der zu wiederholenden async-Funktion (
() => Promise<T>→Promise<T>). - Konfigurierbar: maximale Versuche, Basis-Delay, Backoff-Faktor, maximales Delay, optionales
shouldRetry(error)-Prädikat. - Nach dem letzten fehlgeschlagenen Versuch wird mit dem zuletzt aufgetretenen Fehler abgebrochen (kein stilles Verschlucken).
- Vitest-Tests inklusive Fake-Timers, die die Backoff-Logik und den Abbruch nach
maxAttemptsprüfen.
Begründe im Anschluss kurz die wichtigsten Designentscheidungen (u. a. warum Jitter, wie das Delay gedeckelt wird).