generated from nhcarrigan/template
feat: Claude Code CLI v2.1.105–v2.1.131 support #274
@@ -81,7 +81,7 @@ pub async fn list_sessions(app: AppHandle) -> Result<Vec<SessionListItem>, Strin
|
|||||||
let mut items: Vec<SessionListItem> = sessions.iter().map(SessionListItem::from).collect();
|
let mut items: Vec<SessionListItem> = sessions.iter().map(SessionListItem::from).collect();
|
||||||
|
|
||||||
// Sort by last activity, most recent first
|
// Sort by last activity, most recent first
|
||||||
items.sort_by(|a, b| b.last_activity_at.cmp(&a.last_activity_at));
|
items.sort_by_key(|b| std::cmp::Reverse(b.last_activity_at));
|
||||||
|
|
||||||
Ok(items)
|
Ok(items)
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ pub async fn search_sessions(app: AppHandle, query: String) -> Result<Vec<Sessio
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// Sort by last activity, most recent first
|
// Sort by last activity, most recent first
|
||||||
matching.sort_by(|a, b| b.last_activity_at.cmp(&a.last_activity_at));
|
matching.sort_by_key(|b| std::cmp::Reverse(b.last_activity_at));
|
||||||
|
|
||||||
Ok(matching)
|
Ok(matching)
|
||||||
}
|
}
|
||||||
@@ -348,7 +348,7 @@ mod tests {
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Sort by last activity, most recent first (mimics list_sessions behavior)
|
// Sort by last activity, most recent first (mimics list_sessions behavior)
|
||||||
sessions.sort_by(|a, b| b.last_activity_at.cmp(&a.last_activity_at));
|
sessions.sort_by_key(|b| std::cmp::Reverse(b.last_activity_at));
|
||||||
|
|
||||||
assert_eq!(sessions[0].id, "new");
|
assert_eq!(sessions[0].id, "new");
|
||||||
assert_eq!(sessions[1].id, "old");
|
assert_eq!(sessions[1].id, "old");
|
||||||
|
|||||||
@@ -920,10 +920,9 @@ impl WslBridge {
|
|||||||
let stats = self.stats.read();
|
let stats = self.stats.read();
|
||||||
for tool_name in &tools {
|
for tool_name in &tools {
|
||||||
if let Some(tool_stats) = stats.session_tools_usage.get(tool_name) {
|
if let Some(tool_stats) = stats.session_tools_usage.get(tool_name) {
|
||||||
if tool_stats.call_count > 0 {
|
if let Some(avg_tokens) = (tool_stats.estimated_input_tokens + tool_stats.estimated_output_tokens)
|
||||||
// Use session average tokens per call for this tool
|
.checked_div(tool_stats.call_count)
|
||||||
let avg_tokens = (tool_stats.estimated_input_tokens + tool_stats.estimated_output_tokens)
|
{
|
||||||
/ tool_stats.call_count;
|
|
||||||
tool_overhead_tokens += avg_tokens;
|
tool_overhead_tokens += avg_tokens;
|
||||||
tracing::info!("[COST ESTIMATION] Tool {} average: {} tokens", tool_name, avg_tokens);
|
tracing::info!("[COST ESTIMATION] Tool {} average: {} tokens", tool_name, avg_tokens);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user