feat: Thinking-/Reasoning-Blöcke unterstützen und anzeigen - #48
Merged
Conversation
Two separate problems, per #26. Correctness first: with thinking on, an Anthropic response contains thinking blocks, and the next request is rejected unless they come back untouched — the signature is cryptographic. ContentBlock now knows Thinking and RedactedThinking, both round-trip through the session file, and both are parsed and re-serialised losslessly. Visibility second: thinking now streams into the transcript as it arrives, so a long research phase is no longer silent. The request shape is the current one, not the one the issue describes. budget_tokens was removed on Anthropic models from 4.7 on and returns a 400 — verified live against claude-sonnet-5. Depth is an effort level instead: thinking: {type: "adaptive", display: "summarized"} output_config: {effort: "medium"} display matters: it defaults to "omitted", which streams thinking blocks whose text is empty — thinking still happens and is still billed, but there would be nothing to show. The token-budget form stays for models older than 4.6, unset by default and only reachable by configuring thinking_budget explicitly. Its max_tokens guard stays with it. Compaction drops thinking blocks when summarising old turns; blocks in turns that have not been compacted stay untouched, so the signature requirement holds. OpenAI's reasoning_effort was hardcoded to "none" and is now configurable. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #26.
Was drin ist
Korrektheit.
ContentBlockkennt jetztThinkingundRedactedThinking. Die Signatur wird byte-genau geparst, gespeichert und zurückgeschickt — ohne das lehnt Anthropic den Folge-Request ab. Alte Sessions, die vor dem Feature gespeichert wurden, deserialisieren weiterhin (signaturehat einen Declaration-Default).Sichtbarkeit. Thinking streamt live ins Transcript (
thinking_delta/thinking_block, inkl.--json).Compaction. Beim Zusammenfassen alter Turns werden Thinking-Blöcke verworfen; in noch ungekürzten Turns bleiben sie unangetastet.
OpenAI.
reasoning_effortwar auf"none"hartcodiert und ist jetzt konfigurierbar.Abweichung von der Issue-Spec
Das Issue nennt
thinking: { type: "enabled", budget_tokens: N }. Diese Form ist auf Anthropic-Modellen ab 4.7 entfernt und liefert einen 400 — live gegenclaude-sonnet-5reproduziert:Gesendet wird deshalb:
displayist nicht kosmetisch: der Default ist"omitted", dann kommen Thinking-Blöcke mit leerem Text — gedacht und abgerechnet wird trotzdem, nur anzuzeigen gäbe es nichts.Die Budget-Form bleibt für Modelle älter als 4.6 erhalten, per Default ungesetzt und nur über ein explizites
thinking_budgeterreichbar. Dermax_tokens-Guard aus der Spec hängt an ihr.Konfiguration
Dazu
--think/--no-think.Verifikation
claude-sonnet-5: ohne--thinkunverändert; mit--thinkstreamenthinking_delta-Events mit Inhalt und der akkumuliertethinking_blockstimmt🤖 Generated with Claude Code