fabro/lib/components/fabro-store/src
Bryan Helmkamp ef86ad278a
Carry usage as lithos-llm's Usage and rename billing to usage
Re-pin lithos-llm to 55add4596b861a0623d00c3a54aa5c147c8d504b and
pebble to c91810fe51aece80359b9cd8efea971af0c46925, where token usage
and cost travel together as Usage { tokens: TokenCounts, cost:
Option<Cost> }. Fabro now carries that one type everywhere it used to
carry BilledTokenCounts, BilledModelUsage, UsdMicros, or a token count
beside a cost_usd_micros.

fabro-types: billing.rs is usage.rs with ModelRef, ModelUsage { model,
usage }, sum_usage, and usage_is_empty; billing_rollup.rs is
usage_rollup.rs with ProjectionUsageStage, ProjectionUsageByModel,
ProjectionUsageRollup, and usage_rollup_from_projection. Every usage
field is named usage: StageProjection.usage and usage_by_model,
Outcome<Option<ModelUsage>>, stage.completed and stage.failed usage and
usage_by_model, prompt.completed usage, run.completed and run.failed
usage (total_usd_micros is gone), Conclusion.usage, StageSummary.usage,
Run.usage. RunSize buckets by Cost.

fabro-workflow: model_usage_from_llm prices tokens from the catalog with
a Catalog cost source, with_reported_cost keeps a provider cost, and the
pebble handler's stage_usage groups pebble's accounts by model and sums
rows with Usage::saturating_add, so a total has a cost only when every
priced part was priced. The store fold's live usage is the agent's
usage plus its descendants'.

API: the OpenAPI spec deletes BilledTokenCounts, BilledModelUsage,
CompletionUsage, CompletionCost, TokenUsage, and RunBillingSummary,
adds TokenCounts, Cost, Usage, and ModelUsage, and renames every
billing schema, property, tag, path, and operation to usage. fabro-api
reuses lithos-llm's and fabro-types' types through with_replacement,
with a round-trip test per replacement.

Old stored runs get no migration: their pebble events in the old shape
read back with zero usage, and their rebuilt projections lose agent
usage.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-14 12:31:34 -06:00
..
record Share activation backup helpers and trim run-history residue 2026-08-28 17:20:05 -04:00
slate Retire legacy manifest run creation 2026-09-13 08:49:50 -06:00
test_support Run agent stages, Ask Fabro, and fabro exec on pebble's CodingAgent 2026-09-11 14:19:15 -06:00
artifact_store.rs refactor: simplify artifact ZIP download 2026-08-01 09:09:54 -04:00
auth_code_store.rs Keep auth code store naming consistent 2026-08-24 17:26:17 -04:00
auth_session_store.rs Simplify SQLite authorization-code cutover 2026-08-24 17:25:38 -04:00
blob_store.rs Activate atomic SQLite run history storage 2026-08-28 15:18:25 -04:00
error.rs Activate atomic SQLite run history storage 2026-08-28 15:18:25 -04:00
keyed_mutex.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
keys.rs Simplify session owner lookup and migration preflight 2026-08-31 14:59:38 -04:00
legacy_blob_import.rs Keep the RunSummaryStore name until the SQL cutover 2026-08-27 15:43:56 -04:00
legacy_run_history_import.rs Centralize run projection replay on ProjectedRun 2026-09-02 16:33:14 -04:00
lib.rs Run agent stages, Ask Fabro, and fabro exec on pebble's CodingAgent 2026-09-11 14:19:15 -06:00
run_session_record_store.rs Run agent stages, Ask Fabro, and fabro exec on pebble's CodingAgent 2026-09-11 14:19:15 -06:00
run_sessions.rs Run agent stages, Ask Fabro, and fabro exec on pebble's CodingAgent 2026-09-11 14:19:15 -06:00
run_state.rs Carry usage as lithos-llm's Usage and rename billing to usage 2026-09-14 12:31:34 -06:00
run_summary_store.rs Carry usage as lithos-llm's Usage and rename billing to usage 2026-09-14 12:31:34 -06:00
serializable_projection.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
sqlite_row.rs Simplify SQLite authorization-code cutover 2026-08-24 17:25:38 -04:00
types.rs fabro(01KYQMV1VW6139EGNHEM1RGF2G): implement (succeeded) 2026-07-29 20:35:54 +00:00