Skip to content

feat(control-plane): revamp bank stats view and modernize shared UI primitives#1055

Merged
nicoloboschi merged 2 commits intomainfrom
feat/bank-stats-ui
Apr 14, 2026
Merged

feat(control-plane): revamp bank stats view and modernize shared UI primitives#1055
nicoloboschi merged 2 commits intomainfrom
feat/bank-stats-ui

Conversation

@nicoloboschi
Copy link
Copy Markdown
Collaborator

Summary

  • Rework the bank stats tab into a dashboard-grade view: unified Memory-store card with composition + link types side-by-side, consolidation + mental-model staleness cards, modern palette, and a toggleable per-fact-type memories-ingested area chart with a 1h/12h/1d/7d/30d/90d period switcher.
  • Modernize the shared Card and Table primitives (softer ring, dark-mode-aware shadow, rounded-xl, softer row borders) — every card and table in the app picks up the new look.
  • Align the fact-type filter (used on the recall page) with the new chart palette so memory types look consistent across views.

Backend

  • New endpoint GET /v1/default/banks/{bank_id}/stats/memories-timeseries?period=<1h|12h|1d|7d|30d|90d> returning a fully-padded bucket set broken down by fact type. Buckets are anchored on UTC boundaries (deterministic across deployments; matches client-side ISO keys for zero-fill). Response shape: MemoriesTimeseriesResponse { bank_id, period, trunc, buckets: [MemoryTimeseriesBucket] }.
  • BankStatsResponse gains operations_by_status: dict[str, int].
  • Both changes covered by tests/test_bank_stats.py (10 cases: all periods, empty-bank zero-fill, retained memories land in the right bucket, invalid period fallback, ops-status passthrough).

Client / UI

  • OpenAPI + Python / TypeScript / Go SDKs regenerated.
  • New control-plane proxy route /api/stats/[agentId]/memories-timeseries.
  • bank-stats-view.tsx rewritten: unified card layout, palette driven by CSS vars (--primary / --chart-1..5 where appropriate, with brand hexes kept for link types to match the graph view), custom ChartTooltip, reusable Distribution + ProgressRow helpers, period & toggleable-series state.

Test plan

  • Unit/integration: cd hindsight-api-slim && uv run pytest tests/test_bank_stats.py -v — 10 passing.
  • Lint: ./scripts/hooks/lint.sh — passing.
  • Manual UI: load a bank, confirm
    • Memory store card renders with composition + link types side by side
    • Period switcher refetches and chart shows continuous line with empty days as zeros
    • Toggling fact-type pills adds/removes the corresponding stacked area
    • Consolidation + Mental Models cards show progress bars (up-to-date vs stale)
    • Tables everywhere have the new soft-ring container with no doubled borders
    • Recall page fact-type filter uses the new violet/pink/indigo palette
    • Dark mode: cards, chart strokes, tooltips all visible (no more black strokes)

…rimitives

Rework the bank stats tab to be dashboard-grade. Adds a new memories-ingested
time-series endpoint (1h/12h/1d/7d/30d/90d, zero-filled UTC buckets, per
fact-type breakdown), per-fact-type toggleable area chart, consolidated card
layout, modern palette, period switcher, and a memory-type staleness card for
mental models.

Also modernizes shared UI primitives so the new look propagates everywhere:

- ui/card.tsx: drop the harsh white border, use a soft ring + dark-mode-aware
  shadow, rounded-xl.
- ui/table.tsx: self-contained rounded card with subtle ring, modern uppercase
  header tint, softer row borders, last-row border collapse. Callers no longer
  need border/rounded wrapping divs.
- fact-type-filter.tsx: align memory-type switch colors (World=violet,
  Experience=pink, Observation=indigo) with the stats chart palette.

Backend:
- BankStatsResponse gains operations_by_status (all statuses grouped).
- GET /v1/default/banks/{bank_id}/stats/memories-timeseries returns padded
  bucket sets anchored on UTC for a stable, timezone-independent response.
- Both fields/endpoints covered by tests in tests/test_bank_stats.py.

Clients: OpenAPI + Python/TypeScript/Go SDKs regenerated.
…overage

- bank-stats-view.tsx: use recharts TooltipContentProps (not TooltipProps) with
  Partial<> so <Tooltip content={<ChartTooltip />}> type-checks in recharts v3;
  introduce OpsStatusEntry to widen the tuple-inferred literal union.
- Regenerate skills/hindsight-docs/references/openapi.json via
  scripts/generate-docs-skill.sh so verify-generated-files passes.
- Add get_memories_timeseries to hindsight-cli/.openapi-coverage.toml skip
  list; this endpoint only makes sense for the UI chart.
@nicoloboschi nicoloboschi merged commit 34365c3 into main Apr 14, 2026
50 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant