Skip to content

Commit abcd2f4

Browse files
committed
feat(dashboard): add context token breakdown to session viewer
New Tokens tab shows estimated token counts and percentages for compartments, facts, memories, and conversation+system sections. Includes a stacked bar visualization and detailed legend with counts. Fixed memory count to read from session_meta.memory_block_count instead of trying to parse the rendered XML block as JSON.
1 parent 17a3a10 commit abcd2f4

File tree

6 files changed

+530
-79
lines changed

6 files changed

+530
-79
lines changed

packages/dashboard/src-tauri/src/commands.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,16 @@ pub fn get_session_meta(
122122
db::get_session_meta(&conn, &session_id).map_err(|e| e.to_string())
123123
}
124124

125+
#[tauri::command]
126+
pub fn get_context_token_breakdown(
127+
state: State<'_, AppState>,
128+
session_id: String,
129+
) -> Result<Option<db::ContextTokenBreakdown>, String> {
130+
let path = state.get_db_path()?;
131+
let conn = db::open_readonly(&path).map_err(|e| e.to_string())?;
132+
db::get_context_token_breakdown(&conn, &session_id).map_err(|e| e.to_string())
133+
}
134+
125135
// ── Dreamer commands ────────────────────────────────────────
126136

127137
#[tauri::command]

0 commit comments

Comments
 (0)