mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-04 06:04:48 +08:00
Extended thinking needed to travel end-to-end through the API, runtime, and CLI so the client can request a thinking budget, preserve streamed reasoning blocks, and present them in a collapsed text-first form. The implementation keeps thinking strictly opt-in, adds a session-local toggle, and reuses the existing flag/slash-command/reporting surfaces instead of introducing a new UI layer. Constraint: Existing non-thinking text/tool flows had to remain backward compatible by default Constraint: Terminal UX needed a lightweight collapsed representation rather than an interactive TUI widget Rejected: Heuristic CLI-only parsing of reasoning text | brittle against structured stream payloads Rejected: Expanded raw thinking output by default | too noisy for normal assistant responses Confidence: medium Scope-risk: moderate Reversibility: clean Directive: Keep thinking blocks structurally separate from answer text unless the upstream API contract changes Tested: cargo fmt --all; cargo clippy --workspace --all-targets -- -D warnings; cargo test -q Not-tested: Live upstream thinking payloads against the production API contract
18 lines
646 B
Rust
18 lines
646 B
Rust
mod client;
|
|
mod error;
|
|
mod sse;
|
|
mod types;
|
|
|
|
pub use client::{
|
|
oauth_token_is_expired, resolve_saved_oauth_token, resolve_startup_auth_source,
|
|
AnthropicClient, AuthSource, MessageStream, OAuthTokenSet,
|
|
};
|
|
pub use error::ApiError;
|
|
pub use sse::{parse_frame, SseParser};
|
|
pub use types::{
|
|
ContentBlockDelta, ContentBlockDeltaEvent, ContentBlockStartEvent, ContentBlockStopEvent,
|
|
InputContentBlock, InputMessage, MessageDelta, MessageDeltaEvent, MessageRequest,
|
|
MessageResponse, MessageStartEvent, MessageStopEvent, OutputContentBlock, StreamEvent,
|
|
ThinkingConfig, ToolChoice, ToolDefinition, ToolResultContentBlock, Usage,
|
|
};
|