This adds token and estimated cost reporting to runtime usage tracking and surfaces it in the CLI status and turn output. It also upgrades compaction summaries so users see a clearer resumable summary and token savings after /compact. The verification path required cleaning existing workspace clippy and test friction in adjacent crates so cargo fmt, cargo clippy -D warnings, and cargo test succeed from the Rust workspace root in this repo state. Constraint: Keep the change incremental and user-visible without a large CLI rewrite Constraint: Verification must pass with cargo fmt, cargo clippy --all-targets --all-features -- -D warnings, and cargo test Rejected: Implement a full model-pricing table now | would add more surface area than needed for this first UX slice Confidence: high Scope-risk: moderate Reversibility: clean Directive: If pricing becomes model-specific later, keep the current estimate labeling explicit rather than implying exact billing Tested: cargo fmt; cargo clippy --all-targets --all-features -- -D warnings; cargo test -q Not-tested: Live Anthropic API interaction and real streaming terminal sessions
42 lines
1.4 KiB
Rust
42 lines
1.4 KiB
Rust
mod bash;
|
|
mod bootstrap;
|
|
mod compact;
|
|
mod config;
|
|
mod conversation;
|
|
mod file_ops;
|
|
mod json;
|
|
mod permissions;
|
|
mod prompt;
|
|
mod session;
|
|
mod usage;
|
|
|
|
pub use bash::{execute_bash, BashCommandInput, BashCommandOutput};
|
|
pub use bootstrap::{BootstrapPhase, BootstrapPlan};
|
|
pub use compact::{
|
|
compact_session, estimate_session_tokens, format_compact_summary,
|
|
get_compact_continuation_message, should_compact, CompactionConfig, CompactionResult,
|
|
};
|
|
pub use config::{
|
|
ConfigEntry, ConfigError, ConfigLoader, ConfigSource, RuntimeConfig,
|
|
CLAUDE_CODE_SETTINGS_SCHEMA_NAME,
|
|
};
|
|
pub use conversation::{
|
|
ApiClient, ApiRequest, AssistantEvent, ConversationRuntime, RuntimeError, StaticToolExecutor,
|
|
ToolError, ToolExecutor, TurnSummary,
|
|
};
|
|
pub use file_ops::{
|
|
edit_file, glob_search, grep_search, read_file, write_file, EditFileOutput, GlobSearchOutput,
|
|
GrepSearchInput, GrepSearchOutput, ReadFileOutput, StructuredPatchHunk, TextFilePayload,
|
|
WriteFileOutput,
|
|
};
|
|
pub use permissions::{
|
|
PermissionMode, PermissionOutcome, PermissionPolicy, PermissionPromptDecision,
|
|
PermissionPrompter, PermissionRequest,
|
|
};
|
|
pub use prompt::{
|
|
load_system_prompt, prepend_bullets, ContextFile, ProjectContext, PromptBuildError,
|
|
SystemPromptBuilder, FRONTIER_MODEL_NAME, SYSTEM_PROMPT_DYNAMIC_BOUNDARY,
|
|
};
|
|
pub use session::{ContentBlock, ConversationMessage, MessageRole, Session, SessionError};
|
|
pub use usage::{format_usd, TokenUsage, UsageCostEstimate, UsageTracker};
|