@koinzhang/paseo-plugin-activity 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/README.md +14 -7
  3. package/client/activity-heatmap.tsx +115 -74
  4. package/client/agent-creations.tsx +97 -88
  5. package/client/attention-pill.tsx +16 -5
  6. package/client/attention-popover.tsx +19 -23
  7. package/client/design-tokens.test.ts +39 -0
  8. package/client/design-tokens.ts +168 -0
  9. package/client/formatted-time.tsx +4 -4
  10. package/client/global-surface.tsx +236 -268
  11. package/client/header-button.ts +136 -0
  12. package/client/hourly-activity-timeline.tsx +136 -103
  13. package/client/panel-visibility.test.ts +25 -0
  14. package/client/panel-visibility.ts +45 -0
  15. package/client/panel.tsx +83 -108
  16. package/client/provider-dropdown.tsx +131 -0
  17. package/client/provider-filter.test.ts +17 -13
  18. package/client/provider-filter.ts +5 -7
  19. package/client/rank-color.ts +3 -3
  20. package/client/ranking-bars.tsx +291 -0
  21. package/client/ui.tsx +339 -0
  22. package/client/usage-popover.tsx +62 -134
  23. package/client/usage-stats.tsx +29 -11
  24. package/client/use-agent-turn-end.ts +2 -1
  25. package/client/use-app-language.ts +17 -0
  26. package/client/web.ts +73 -18
  27. package/client/workspace/agent-row.tsx +18 -25
  28. package/client/workspace/agents-section.tsx +23 -20
  29. package/client/workspace/constants.ts +6 -6
  30. package/client/workspace/display-menu.tsx +5 -4
  31. package/client/workspace/filters.test.ts +1 -1
  32. package/client/workspace/filters.ts +4 -2
  33. package/client/workspace/panel.tsx +89 -103
  34. package/client/workspace/rank-section.tsx +36 -62
  35. package/client/workspace/terminals-section.tsx +13 -9
  36. package/index.client.tsx +40 -20
  37. package/index.server.ts +53 -51
  38. package/package.json +2 -2
  39. package/paseo-plugin.json +2 -1
  40. package/server/agents.ts +20 -2
  41. package/server/background-sync.ts +34 -4
  42. package/server/handlers-query.test.ts +27 -1
  43. package/server/handlers.ts +75 -31
  44. package/server/ingest.test.ts +8 -0
  45. package/server/messages.test.ts +96 -1
  46. package/server/prompt-dedupe.ts +52 -0
  47. package/server/rpc-cache.test.ts +74 -0
  48. package/server/rpc-cache.ts +48 -0
  49. package/server/store.test.ts +122 -0
  50. package/server/store.ts +313 -19
  51. package/server/ttl-cache.ts +3 -0
  52. package/shared/activity.test.ts +36 -0
  53. package/shared/activity.ts +37 -0
  54. package/shared/classify.test.ts +1 -10
  55. package/shared/classify.ts +3 -10
  56. package/shared/format.ts +10 -7
  57. package/shared/i18n.test.ts +34 -0
  58. package/shared/i18n.ts +363 -0
  59. package/shared/insights.test.ts +120 -81
  60. package/shared/insights.ts +124 -63
  61. package/shared/usage.test.ts +121 -0
  62. package/shared/usage.ts +191 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,39 @@ All notable changes to `@koinzhang/paseo-plugin-activity` are documented in this
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.7.0] - 2026-09-27
9
+
10
+ ### Added
11
+
12
+ - Global Activity **Providers** ranking: one bar per provider, cycling Sessions / Prompts / Skill calls / MCP calls from the section header; a selected provider stays highlighted while the others dim.
13
+ - Global Activity **Projects** ranking under Providers, with the same metric switch and provider filter. Projects resolve from the workspace's project root (recorded while the workspace is listed), the agent `cwd` under a known project, or a sibling in the same Paseo worktree; the rest group under Other.
14
+ - `usage.by-project` RPC; the agent registry now records `cwd` and `project_root`.
15
+ - `usage.agent-lifetime` now also reports average engaged session time and prompted / multi-turn session counts.
16
+ - Heatmap, Last 30 days histogram and Timeline each get a Sessions / Prompts / Skill calls / MCP calls switch (default Sessions); the timeline draws a single series for the chosen metric.
17
+ - Global KPI tiles compare against the previous 7 days: Sessions / Prompts show the change vs prev. 7d, Top provider / Top model show the previous window's leader; the provider filter applies to both windows.
18
+ - Providers and Projects rankings collapse to five rows with a `Show N more` / `Show less` toggle.
19
+
20
+ ### Changed
21
+
22
+ - Requires Paseo **>= 0.9.0** (was >= 0.9.0-beta.2).
23
+ - Activity insights now show Active days, Busiest day, Workspaces, Coding vs chat, Longest streak, Peak weekday (full name), Multi-turn sessions (share of prompted sessions with 2+ prompts) and Avg session duration (engaged time, idle gaps over 30 min skipped). Skill / MCP calls, Prompts per session and Longest session were removed.
24
+ - Global Activity says **Sessions** wherever it counts agent conversations (KPI, Insights, creations histogram, timeline, heatmap tooltip, empty state). Workspace / Agent Agents lists are unchanged.
25
+ - Global filter bar: the range chips are gone (the page is all-time) and provider chips became a `Provider: All ▾` dropdown listing every provider instead of the top 5.
26
+ - Global KPI: Sessions, Prompts, Top provider · share, Top model · share. Active days, Peak weekday and Longest streak moved into Insights.
27
+ - User-sent messages are called **Prompts** in every Activity view; the Workspace "Show → Prompt" preview is now "Latest prompt".
28
+ - Most used models lists every model; skills / MCP stay capped at 8.
29
+ - The heatmap no longer shows the Daily / Weekly / Cumulative switch (always daily).
30
+ - Global chart titles name their granularity: Activity Calendar (heatmap), Daily Activity (30-day histogram), Hourly Activity (timeline).
31
+ - Activity insights put Longest streak and Peak weekday above Workspaces.
32
+
33
+ ### Fixed
34
+
35
+ - Rescans no longer overwrite an event's real time with the later replay time: upserts keep the earliest timestamp, an event time can never be later than its first ingest, and existing rows are repaired on startup.
36
+ - Replayed copies of a prompt are dropped: a prompt sent live and later replayed by the provider is stored once, keeping the live row's real time and model.
37
+ - The Global `Provider: All ▾` filter is right-aligned in the content area, and its menu opens right-aligned under the trigger.
38
+ - Oh My Pi (`omp`) is counted as its own provider everywhere instead of being merged into Pi; stored data is unchanged.
39
+ - KPI fit-to-width accounts for the tile divider, so values that just fit no longer ellipsize by a pixel.
40
+
8
41
  ## [0.6.0] - 2026-09-22
9
42
 
10
43
  Requires Paseo **>= 0.9.0-beta.2**.
@@ -155,7 +188,8 @@ Last release that supports Paseo **0.8.0**. Later versions require Paseo **>= 0.
155
188
  - Command Center entries: open panels and export a markdown usage report.
156
189
  - Plugin renamed from `tool-usage` to `activity`, migrating the old data directory automatically.
157
190
 
158
- [Unreleased]: https://github.com/koinzhang/paseo-plugins/compare/activity-v0.6.0...HEAD
191
+ [Unreleased]: https://github.com/koinzhang/paseo-plugins/compare/activity-v0.7.0...HEAD
192
+ [0.7.0]: https://github.com/koinzhang/paseo-plugins/releases/tag/activity-v0.7.0
159
193
  [0.6.0]: https://github.com/koinzhang/paseo-plugins/releases/tag/activity-v0.6.0
160
194
  [0.5.0]: https://github.com/koinzhang/paseo-plugins/releases/tag/activity-v0.5.0
161
195
  [0.4.0]: https://github.com/koinzhang/paseo-plugins/releases/tag/activity-v0.4.0
package/README.md CHANGED
@@ -6,8 +6,8 @@ It still answers “how am I using Paseo” (tools, messages, models, habits). W
6
6
 
7
7
  | Scope | Role |
8
8
  |---|---|
9
- | **Global** | Cross-workspace habits: heatmap, rolling 168-hour activity timeline, provider filter, insights, most-used skills / MCP / models |
10
- | **Workspace** | Per-workspace agent fleet: ranked list + display prefs + archive; live status (permission / finished / error / running); open Terminals; shell / file / messages KPIs; times via shared `FormattedTime` |
9
+ | **Global** | Cross-workspace habits: KPI vs the previous 7 days, daily heatmap, rolling 168-hour activity timeline, `Provider: All ▾` filter, per-chart Sessions / Prompts / Skill calls / MCP calls switches, collapsible Providers / Projects rankings, insights, most-used skills / MCP / models |
10
+ | **Workspace** | Per-workspace agent fleet: ranked list + display prefs + archive; live status (permission / finished / error / running); open Terminals; shell / file / prompt KPIs; times via shared `FormattedTime` |
11
11
  | **Agent** | Current session: dense tool KPIs, Skills / MCP header toggle, SKILL.md reader, composer Activity pill; **Needs attention** pill jumps to other same-workspace finished/permission/error sessions |
12
12
 
13
13
  Architecture notes: [docs/architecture.md](./docs/architecture.md).
@@ -20,14 +20,14 @@ Ingests every agent's Paseo timeline into a local SQLite database. Queries read
20
20
  |---|---|
21
21
  | Tools | Skill / MCP / shell / file calls; skills classified into exact / inferred / low confidence tiers |
22
22
  | Agents | Every created agent (registry with archive metadata) |
23
- | Messages | User-sent messages |
23
+ | Prompts | User-sent messages (called **Prompts** in every Activity view) |
24
24
  | Models | Model at send time (weighted by messages; global view) |
25
25
 
26
26
  ## Where it shows up
27
27
 
28
- - **Sidebar Activity** — global view by provider (heatmap, KPIs, insights, most used)
28
+ - **Sidebar Activity** — all-time global view by provider (KPI with prev-7d comparison, Activity Calendar heatmap, Daily Activity 30-day histogram, Hourly Activity 168-hour timeline, Providers / Projects rankings, insights, most used)
29
29
  - **Explorer → Activity** — workspace agents as a management list (search / sort / group / status / lifecycle / archive), live attention (permission badge, status colors, running spinner; API-owned directory observation + explicit lifecycle/archive fields + 15s reconciliation), open Terminals (list / preview / close), plus workspace KPIs and Skills / MCP ranked or newest-call timeline views (with agent titles and one shared persisted view choice); usage queries get a best-effort refresh hint when agents leave running
30
- - **Agent workspace panel** — per-agent tool detail (dense KPI including messages / Skills / MCP toggle / SKILL.md); refreshes on timeline turn terminal events
30
+ - **Agent workspace panel** — per-agent tool detail (dense KPI including prompts / Skills / MCP toggle / SKILL.md); refreshes on timeline turn terminal events
31
31
  - **Composer pills** — Activity: current agent's skill / MCP summary (hidden when empty); **Needs attention**: other same-workspace agents with finished / permission / error (hidden when none; click opens shared list)
32
32
  - **Command Center** — Activity · Workspace Activity · Agent Activity
33
33
 
@@ -37,7 +37,7 @@ Everything lives on the daemon machine in `~/.paseo/plugin-data/activity/` (SQLi
37
37
 
38
38
  ## Install
39
39
 
40
- Requires Paseo **>= 0.9.0-beta.2** (current package targets **0.9.0-beta.2**). **0.4.0** is the last release that supports Paseo 0.8.0.
40
+ Requires Paseo **>= 0.9.0**. **0.4.0** is the last release that supports Paseo 0.8.0.
41
41
 
42
42
  From Git (Paseo 0.8 and later):
43
43
 
@@ -52,6 +52,12 @@ paseo plugin install npm:@koinzhang/paseo-plugin-activity
52
52
  # Paseo 0.8: npm:@koinzhang/paseo-plugin-activity@0.4.0
53
53
  ```
54
54
 
55
+ From a local checkout (development), run this inside `activity/`. It uses the same plugin ID `activity`, so don't pass `--id`, and it shares the same data directory:
56
+
57
+ ```bash
58
+ paseo plugin install "$PWD" # absolute path; `paseo plugin remove activity` first if npm is installed
59
+ ```
60
+
55
61
  After source changes, reload and check status:
56
62
 
57
63
  ```bash
@@ -65,6 +71,7 @@ paseo plugin ls
65
71
  - Analytics and the agent registry are local to each daemon: every machine keeps its own database, and there is no cross-host aggregation.
66
72
  - Numbers are reconstructed from the Paseo timeline; items that do not report a model or skill cannot be attributed for that dimension.
67
73
  - Skill classification is heuristic (exact / inferred / low confidence); check the tier before trusting a count.
74
+ - Project attribution for the Projects ranking comes from the workspace root recorded while it was listed, or the agent `cwd`; sessions with neither group under **Other**.
68
75
  - Workspace Activity focuses on agent operations for the current workspace; heatmap / provider / model breakdowns stay on the global sidebar.
69
76
 
70
77
  ## Development
@@ -79,7 +86,7 @@ This plugin is spec-driven: read [specs/README.md](./specs/README.md) before cod
79
86
 
80
87
  ## Publish
81
88
 
82
- Release history: [CHANGELOG.md](./CHANGELOG.md) (current **0.4.0**). npm releases go through a GitHub Release tag `activity-vX.Y.Z` (not push-to-`main` alone). Steps: [CONTRIBUTING.md § Publishing to npm](../CONTRIBUTING.md#publishing-to-npm).
89
+ Release history: [CHANGELOG.md](./CHANGELOG.md) (current **0.6.0**). npm releases go through a GitHub Release tag `activity-vX.Y.Z` (not push-to-`main` alone). Steps: [CONTRIBUTING.md § Publishing to npm](../CONTRIBUTING.md#publishing-to-npm).
83
90
 
84
91
  ## License
85
92
 
@@ -1,11 +1,14 @@
1
- import { useEffect, useMemo, useState } from "react";
2
- import { Pressable, ScrollView, Text, View } from "react-native";
1
+ import { useEffect, useMemo, useRef, useState } from "react";
2
+ import { Animated, Easing, Pressable, ScrollView, Text, View } from "react-native";
3
3
  import type { ActivityDay } from "../shared/usage.ts";
4
- import { activityLevel, buildActivityCalendar, type HeatmapMode } from "../shared/activity.ts";
4
+ import { activityLevel, buildActivityCalendar, metricValue, type ActivityMetric, type HeatmapMode } from "../shared/activity.ts";
5
5
  import { useAppLanguage } from "./use-app-language.ts";
6
6
  import { useMeasuredWidth } from "./measured-width.ts";
7
7
  import { ACTIVITY_MIX_STEPS, mixColor } from "./color-mix.ts";
8
8
  export { computeStreaks, type HeatmapMode } from "../shared/activity.ts";
9
+ import { CHART_MOTION, FONT_SIZE, sectionTitle, titleGap } from "./design-tokens.ts";
10
+ import { messagesFor } from "../shared/i18n.ts";
11
+ import { ChartTooltip, MetricStepper } from "./ui.tsx";
9
12
 
10
13
  type ThemeColors = {
11
14
  accent: string; border: string; foreground: string; foregroundMuted: string;
@@ -14,13 +17,8 @@ type ThemeColors = {
14
17
 
15
18
  type HoveredMonth = { year: number; month: number };
16
19
 
17
- // Month-axis labels and the mode tabs share one size: both are secondary labels under
18
- // the section title, so a separate 13 / 15 scale made the tabs outrank the axis.
19
- const LABEL_FONT_SIZE = 12;
20
-
21
- function plural(count: number, singular: string, pluralForm = `${singular}s`): string {
22
- return `${count.toLocaleString()} ${count === 1 ? singular : pluralForm}`;
23
- }
20
+ // Month-axis labels stay at the secondary label size under the section title.
21
+ const LABEL_FONT_SIZE = FONT_SIZE.label;
24
22
 
25
23
  function cellInMonth(dateKey: string, hovered: HoveredMonth | null): boolean {
26
24
  if (!hovered) return false;
@@ -28,16 +26,15 @@ function cellInMonth(dateKey: string, hovered: HoveredMonth | null): boolean {
28
26
  return year === hovered.year && month === hovered.month + 1;
29
27
  }
30
28
 
31
- export function ActivityHeatmap({ days, from, colors, compact, mode, onModeChange, modeOptions }: {
29
+ export function ActivityHeatmap({ days, from, colors, compact, mode }: {
32
30
  days: readonly ActivityDay[]; from?: string; colors: ThemeColors; compact?: boolean;
33
- mode: HeatmapMode; onModeChange: (mode: HeatmapMode) => void;
34
- modeOptions: ReadonlyArray<{ id: HeatmapMode; label: string }>;
31
+ mode: HeatmapMode;
35
32
  }) {
33
+ const [metric, setMetric] = useState<ActivityMetric>("sessions");
36
34
  const locale = useAppLanguage();
37
35
  const [width, widthRef, onWidthLayout] = useMeasuredWidth("global:heatmap");
38
36
  const [gridTop, setGridTop] = useState(0);
39
37
  const [scrollX, setScrollX] = useState(0);
40
- const [tooltipSize, setTooltipSize] = useState({ width: 220, height: 28 });
41
38
  const [selected, setSelected] = useState<string | null>(null);
42
39
  const [hovered, setHovered] = useState<string | null>(null);
43
40
  const [hoveredMonth, setHoveredMonth] = useState<HoveredMonth | null>(null);
@@ -46,7 +43,34 @@ export function ActivityHeatmap({ days, from, colors, compact, mode, onModeChang
46
43
  setHovered(null);
47
44
  setHoveredMonth(null);
48
45
  }, [from, mode, days]);
49
- const { weeks, months, max } = useMemo(() => buildActivityCalendar(days, mode, from, new Date(), locale), [days, mode, from, locale]);
46
+ const reveal = useRef(new Animated.Value(0)).current;
47
+ const revealedRef = useRef(false);
48
+ const measured = width > 0;
49
+ useEffect(() => {
50
+ if (!measured) return;
51
+ const first = !revealedRef.current;
52
+ reveal.setValue(0);
53
+ const animation = Animated.timing(reveal, {
54
+ toValue: 1,
55
+ duration: first ? CHART_MOTION.reveal : CHART_MOTION.refresh,
56
+ easing: Easing.out(Easing.cubic),
57
+ useNativeDriver: false,
58
+ });
59
+ animation.start(() => {
60
+ revealedRef.current = true;
61
+ });
62
+ return () => animation.stop();
63
+ }, [measured, metric, mode, from, reveal]);
64
+ const { weeks, months } = useMemo(() => buildActivityCalendar(days, mode, from, new Date(), locale), [days, mode, from, locale]);
65
+ // Intensity follows the selected metric only (070), not the four-metric total.
66
+ const max = useMemo(
67
+ () =>
68
+ weeks.flat().reduce(
69
+ (peak, cell) => (cell.future || cell.excluded ? peak : Math.max(peak, metricValue(cell, metric))),
70
+ 0,
71
+ ),
72
+ [weeks, metric],
73
+ );
50
74
  const gap = compact ? 2 : 3;
51
75
  // Fit the full year into the measured width (no min floor — avoid horizontal overflow).
52
76
  const cellSize =
@@ -61,36 +85,36 @@ export function ActivityHeatmap({ days, from, colors, compact, mode, onModeChang
61
85
  const active = activeIndex >= 0 ? weeks.flat()[activeIndex] : undefined;
62
86
  const anchorX = Math.floor(activeIndex / 7) * (cellSize + gap) + cellSize / 2 - scrollX;
63
87
  const anchorY = gridTop + (activeIndex % 7) * (cellSize + gap);
64
- const tooltipLeft = Math.max(0, Math.min(anchorX - tooltipSize.width / 2, width - tooltipSize.width));
65
- const tooltipTop = Math.max(0, anchorY - tooltipSize.height - 8);
66
88
  const dateLabel = active ? (() => {
67
89
  const [year, month, day] = active.key.split("-").map(Number);
68
90
  return new Date(year!, month! - 1, day!).toLocaleDateString(locale, {
69
91
  month: "short", day: "numeric", year: year !== new Date().getFullYear() ? "numeric" : undefined,
70
92
  });
71
93
  })() : "";
72
- const datePrefix = mode === "weekly" ? "in week containing" : mode === "cumulative" ? "through" : "on";
73
- const tooltipText = active
74
- ? `${plural(active.skills, "skill")}, ${plural(active.mcp, "mcp")}, ${plural(active.agents, "agent")}, ${plural(active.messages, "message")} ${datePrefix} ${dateLabel}`
75
- : "";
94
+ const m = messagesFor(locale);
95
+ const periodLabel = (date: string) =>
96
+ mode === "weekly" ? m.heatmap.weekContaining(date) : mode === "cumulative" ? m.heatmap.through(date) : date;
97
+ const tooltipRows = active
98
+ ? [
99
+ { label: m.common.sessions, value: active.agents.toLocaleString(locale) },
100
+ { label: m.common.prompts, value: active.messages.toLocaleString(locale) },
101
+ { label: m.common.skills, value: active.skills.toLocaleString(locale) },
102
+ { label: m.common.mcp, value: active.mcp.toLocaleString(locale) },
103
+ ]
104
+ : [];
105
+ const floor = revealedRef.current ? CHART_MOTION.refreshFloor : 0;
106
+ const columnStep = weeks.length > 1 ? (1 - CHART_MOTION.columnSpan) / (weeks.length - 1) : 0;
76
107
  const axisWidth = needsScroll ? gridWidth : width;
77
- const modeLabel = mode === "weekly" ? "Week containing" : mode === "cumulative" ? "Through" : "";
78
108
  const monthFocus = hoveredMonth != null;
79
109
  return (
80
110
  <View
81
111
  ref={widthRef}
82
- style={{ gap: compact ? 10 : 12 }}
112
+ style={{ gap: titleGap(compact) }}
83
113
  onLayout={onWidthLayout}
84
114
  >
85
115
  <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", justifyContent: "space-between", gap: 12 }}>
86
- <Text style={{ color: colors.foreground, fontSize: compact ? 13 : 15, fontWeight: "500" }}>Activity</Text>
87
- <View style={{ flexDirection: "row", gap: compact ? 14 : 20 }}>
88
- {modeOptions.map(option => (
89
- <Pressable key={option.id} accessibilityRole="tab" accessibilityState={{ selected: mode === option.id }} onPress={() => onModeChange(option.id)} style={{ paddingVertical: 6 }}>
90
- <Text style={{ color: mode === option.id ? colors.foreground : colors.foregroundMuted, fontSize: LABEL_FONT_SIZE }}>{option.label}</Text>
91
- </Pressable>
92
- ))}
93
- </View>
116
+ <Text style={{ ...sectionTitle(compact), color: colors.foreground }}>{m.heatmap.title}</Text>
117
+ <MetricStepper value={metric} onChange={setMetric} colors={colors} />
94
118
  </View>
95
119
  <ScrollView
96
120
  horizontal
@@ -102,44 +126,63 @@ export function ActivityHeatmap({ days, from, colors, compact, mode, onModeChang
102
126
  >
103
127
  <View style={{ width: Math.max(0, axisWidth) }}>
104
128
  <View style={{ flexDirection: "row", gap }}>
105
- {weeks.map((week, i) => (
106
- <View key={i} style={{ gap }}>
107
- {week.map(cell => {
108
- const hidden = cell.future || cell.excluded;
109
- const inMonth = cellInMonth(cell.key, hoveredMonth);
110
- const level = activityLevel(cell.total, max);
111
- const base = palette[level]!;
112
- // Focus = leave target month as-is; gently mute others toward surface2
113
- // (same space as empty cells — preserves activity hue, avoids surface0 parse issues).
114
- const fill =
115
- hidden
116
- ? base
117
- : monthFocus && inMonth
118
- ? mixColor(base, colors.accent, 0.04)
119
- : base;
120
- const opacity = hidden
121
- ? 0
122
- : monthFocus && !inMonth
123
- ? 0.64
124
- : 1;
125
- return (
129
+ {weeks.map((week, i) => {
130
+ const cells = week.map(cell => {
131
+ const hidden = cell.future || cell.excluded;
132
+ const inMonth = cellInMonth(cell.key, hoveredMonth);
133
+ const level = activityLevel(metricValue(cell, metric), max);
134
+ const base = palette[level]!;
135
+ // Focus = leave target month as-is; gently mute others toward surface2
136
+ // (same space as empty cells — preserves activity hue, avoids surface0 parse issues).
137
+ const fill =
138
+ hidden
139
+ ? base
140
+ : monthFocus && inMonth
141
+ ? mixColor(base, colors.accent, 0.04)
142
+ : base;
143
+ const opacity = hidden
144
+ ? 0
145
+ : monthFocus && !inMonth
146
+ ? 0.64
147
+ : 1;
148
+ return { cell, hidden, colored: !hidden && level > 0, fill, opacity };
149
+ });
150
+ const cellShape = { width: cellSize, height: cellSize, borderRadius: Math.max(2, cellSize / 4) };
151
+ return (
152
+ <View key={i} style={{ gap }}>
153
+ {/* Static layer: empty cells and every hit target; only colored cells animate. */}
154
+ {cells.map(({ cell, hidden, colored, fill, opacity }) => (
126
155
  <Pressable key={cell.key} disabled={hidden} accessibilityRole="button"
127
- accessibilityLabel={`${modeLabel} ${cell.key}: ${cell.total} activity, ${cell.skills} skills, ${cell.mcp} MCP, ${cell.agents} agents, ${cell.messages} messages`}
156
+ accessibilityLabel={`${periodLabel(cell.key)}: ${m.units.prompts(cell.messages)}, ${m.units.sessions(cell.agents)}, ${m.units.skills(cell.skills)}, ${m.units.mcp(cell.mcp)}`}
128
157
  accessibilityState={{ selected: activeKey === cell.key }}
129
158
  onHoverIn={() => setHovered(cell.key)} onHoverOut={() => setHovered(null)}
130
159
  onFocus={() => setHovered(cell.key)} onBlur={() => setHovered(null)}
131
160
  onPress={() => setSelected(prev => prev === cell.key ? null : cell.key)}
161
+ style={{ ...cellShape, backgroundColor: colored ? "transparent" : fill, opacity }} />
162
+ ))}
163
+ {cells.some(item => item.colored) ? (
164
+ <Animated.View
165
+ pointerEvents="none"
132
166
  style={{
133
- width: cellSize,
134
- height: cellSize,
135
- borderRadius: Math.max(2, cellSize / 4),
136
- backgroundColor: fill,
137
- opacity,
138
- }} />
139
- );
140
- })}
141
- </View>
142
- ))}
167
+ position: "absolute",
168
+ top: 0,
169
+ left: 0,
170
+ gap,
171
+ opacity: reveal.interpolate({
172
+ inputRange: [i * columnStep, i * columnStep + CHART_MOTION.columnSpan],
173
+ outputRange: [floor, 1],
174
+ extrapolate: "clamp",
175
+ }),
176
+ }}
177
+ >
178
+ {cells.map(({ cell, colored, fill, opacity }) => (
179
+ <View key={cell.key} style={{ ...cellShape, backgroundColor: colored ? fill : "transparent", opacity }} />
180
+ ))}
181
+ </Animated.View>
182
+ ) : null}
183
+ </View>
184
+ );
185
+ })}
143
186
  </View>
144
187
  <View style={{ marginTop: 10, flexDirection: "row", justifyContent: "space-between" }}>
145
188
  {months.map((item, i) => {
@@ -149,7 +192,7 @@ export function ActivityHeatmap({ days, from, colors, compact, mode, onModeChang
149
192
  <Pressable
150
193
  key={`${item.year}-${item.month}-${i}`}
151
194
  accessibilityRole="button"
152
- accessibilityLabel={`Highlight ${item.label}`}
195
+ accessibilityLabel={m.heatmap.highlightMonth(item.label)}
153
196
  onHoverIn={() => setHoveredMonth({ year: item.year, month: item.month })}
154
197
  onHoverOut={() => setHoveredMonth(null)}
155
198
  onFocus={() => setHoveredMonth({ year: item.year, month: item.month })}
@@ -172,16 +215,14 @@ export function ActivityHeatmap({ days, from, colors, compact, mode, onModeChang
172
215
  </View>
173
216
  </ScrollView>
174
217
  {active && anchorX >= 0 && anchorX <= width ? (
175
- <View pointerEvents="none"
176
- onLayout={event => setTooltipSize({ width: event.nativeEvent.layout.width, height: event.nativeEvent.layout.height })}
177
- style={{ position: "absolute", left: tooltipLeft, top: tooltipTop, zIndex: 10,
178
- maxWidth: width || 220, paddingHorizontal: 10, paddingVertical: 6,
179
- borderRadius: 8, backgroundColor: colors.surface2,
180
- borderWidth: 1, borderColor: colors.border }}>
181
- <Text accessibilityLiveRegion="polite" style={{ color: colors.foreground, fontSize: 12, lineHeight: 16 }}>
182
- {tooltipText}
183
- </Text>
184
- </View>
218
+ <ChartTooltip
219
+ anchorX={anchorX}
220
+ anchorY={anchorY}
221
+ containerWidth={width}
222
+ title={periodLabel(dateLabel)}
223
+ rows={tooltipRows}
224
+ colors={colors}
225
+ />
185
226
  ) : null}
186
227
  </View>
187
228
  );