huskies: merge 1017

This commit is contained in:
dave
2026-05-13 23:51:12 +00:00
parent 29e800da21
commit 52180bc402
8 changed files with 651 additions and 35 deletions
+12 -3
View File
@@ -6,6 +6,8 @@
//! into `AgentPool` or the filesystem.
//!
//! Conventions: `docs/architecture/service-modules.md`
/// In-memory cost rollup register — written by the cost-rollup subscriber.
pub mod cost_rollup;
mod io;
/// Agent selection heuristics — pick the best agent for a story.
pub mod selection;
@@ -215,13 +217,20 @@ pub fn get_test_results(
io::read_test_results_from_file(project_root, story_id)
}
/// Get the aggregated token cost for a specific story.
/// Get the aggregated token cost for a specific story from the rollup register.
///
/// Returns a zero-cost summary when no rollup has been recorded yet (story
/// still in progress or no token records exist).
pub fn get_work_item_token_cost(
project_root: &Path,
story_id: &str,
) -> Result<TokenCostSummary, Error> {
let records = io::read_token_records(project_root)?;
Ok(token::aggregate_for_story(&records, story_id))
Ok(cost_rollup::get_rollup(project_root, story_id)
.map(|r| r.as_summary())
.unwrap_or(TokenCostSummary {
total_cost_usd: 0.0,
agents: vec![],
}))
}
/// Get all token usage records across all stories.