Expand description
usage_events writer + tool_scores aggregator. Phase 4.
insert_event is idempotent on uuid — re-running toolhub score on the
same JSONL files MUST NOT double-count. recompute_scores rebuilds
tool_scores from scratch (DELETE + INSERT inside a transaction): the
table is a derived projection, so a clean rebuild is simpler than
incremental updates and stays correct as usage_events evolves.
Structs§
Functions§
- count_
events - dead_
weight - Tools that have NOT been used in the last
older_than_daysdays. - insert_
event - INSERT OR IGNORE — returns true if the row was new, false if
uuidcollided with an existing event. Events withoutuuidare always inserted (no dedupe key), so callers should prefer to setuuidwhenever possible. - last_
used - Most-recent
occurred_atfor a tool, used bystats --tool. - list_
events - recompute_
scores - Rebuild
tool_scoresfromusage_events. Returns the number of tool rows written. Intended to be called after a batch ofinsert_eventcalls.