Commit Graph

2 Commits

  • Display blended token count in status line (#21669)
    ## Why
    
    The configurable `/statusline` and terminal title can display session
    token usage. That display was using the raw total token count, which
    includes cached input tokens, so it significantly overstated the token
    usage compared with the blended token count shown elsewhere (in
    `/status` and tracked in goals). This inconsistency resulted in user
    confusion. We don't want to report cached tokens because we don't charge
    for them and they are somewhat of an implementation detail that users
    shouldn't care about.
    
    ## What changed
    
    - Use `TokenUsage::blended_total()` for the `used-tokens` status surface
    item so cached input is excluded.
    - Add a brief comment to `tokens_in_context_window()` clarifying that it
    returns raw `total_tokens`, whose meaning depends on whether the caller
    has last-turn or accumulated usage.
  • Remove core protocol dependency [1/2] (#20324)
    ## Why
    
    This stack moves `codex-tui` away from the core protocol event surface
    and toward app-server API shapes plus TUI-owned local models. This first
    PR sets up the lower-risk foundation: it introduces the local model
    surface and extracts app-server event routing into focused TUI modules
    while preserving the existing behavior for the larger migration in PR2.
    
    This PR is part 1 of a 2-PR stack:
    
    1. Add TUI-owned replacement models and extract app-server event
    routing.
    2. Move the active TUI flow to app-server notifications and delete
    obsolete adapter code.
    
    ## What changed
    
    - Added TUI-owned approval, diff, session state, session resume, token
    usage, and user-message models.
    - Added `app/app_server_event_targets.rs` and `app/app_server_events.rs`
    to hold app-server event targeting and dispatch logic outside `app.rs`.
    - Updated app/status tests to use the local model layer and added
    focused routing coverage.
    - Boxed a few large async TUI test futures so this base layer remains
    checkable without overflowing the default test stack.
    
    ## Verification
    
    - `cargo check -p codex-tui --tests`