@koinzhang/paseo-plugin-activity 0.1.0 → 0.2.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 (42) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +71 -0
  3. package/client/activity-heatmap.tsx +72 -14
  4. package/client/global-surface.tsx +24 -25
  5. package/client/panel.tsx +1 -0
  6. package/client/range.ts +20 -0
  7. package/client/usage-stats.tsx +7 -5
  8. package/client/workspace/agent-row.tsx +117 -0
  9. package/client/workspace/agents-section.tsx +323 -0
  10. package/client/workspace/constants.ts +121 -0
  11. package/client/workspace/display-menu.tsx +116 -0
  12. package/client/workspace/filters.ts +30 -0
  13. package/client/workspace/list-host-agents.ts +57 -0
  14. package/client/workspace/panel.tsx +800 -0
  15. package/client/workspace/rank-section.tsx +121 -0
  16. package/client/workspace-panel.tsx +2 -0
  17. package/index.client.tsx +20 -13
  18. package/index.server.ts +11 -0
  19. package/package.json +8 -2
  20. package/server/agents.test.ts +20 -1
  21. package/server/agents.ts +2 -1
  22. package/server/background-sync.test.ts +14 -3
  23. package/server/background-sync.ts +16 -5
  24. package/server/handlers-query.test.ts +58 -0
  25. package/server/handlers.ts +73 -2
  26. package/server/messages.test.ts +8 -2
  27. package/server/store.test.ts +13 -0
  28. package/server/store.ts +2 -2
  29. package/shared/activity.test.ts +22 -12
  30. package/shared/activity.ts +8 -13
  31. package/shared/agent-page-size.test.ts +11 -0
  32. package/shared/agent-title-search.test.ts +28 -0
  33. package/shared/agent-title-search.ts +12 -0
  34. package/shared/explorer-agent-display.ts +30 -0
  35. package/shared/format.test.ts +22 -1
  36. package/shared/format.ts +24 -0
  37. package/shared/insights.test.ts +38 -18
  38. package/shared/insights.ts +38 -19
  39. package/shared/list-agent-pages.test.ts +51 -0
  40. package/shared/list-agent-pages.ts +31 -0
  41. package/shared/usage.test.ts +248 -0
  42. package/shared/usage.ts +327 -11
package/CHANGELOG.md ADDED
@@ -0,0 +1,56 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@koinzhang/paseo-plugin-activity` are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.0] - 2026-09-19
11
+
12
+ ### Added
13
+
14
+ - Heatmap month focus: hovering a month label highlights that month's cells and dims the rest.
15
+ - Workspace Activity panel in the Explorer sidebar: workspace-scoped KPIs (shell calls / file reads / file writes / messages), per-agent ranking (new `usage.agents` RPC), and top skills / MCP; the Workspace Activity Command Center item opens it.
16
+ - Explorer Agents title search: a header search icon expands an animated inline pill; case-insensitive tokenized match on title (falls back to agent id) that stacks with Status / Lifecycle filters, sort, and grouping; the query is session-only.
17
+ - Explorer Agents archive / unarchive row actions: Active rows show Archive (host `agents.ref(id).archive()`), Archived rows show Unarchive (new `usage.agent.unarchive` RPC → `paseo agent reload`), with optimistic list updates, error toast, and the local registry `archived_at` cleared on unarchive.
18
+ - Agent panel Messages KPI via `usage.summary.messageCount` (same filter as tools).
19
+ - Architecture overview for Global / Workspace / Agent scopes (`docs/architecture.md`).
20
+ - Explorer Agents list pager (40 per page); controls hidden when there is only one page.
21
+ - Host `agents.list` pagination for Explorer status enrichment and background history sync.
22
+
23
+ ### Changed
24
+
25
+ - Coding vs chat now counts active agents instead of ops: an agent counts as coding when it has a file write/edit/delete or a mutating shell command; created-only agents are excluded from both buckets.
26
+ - Insights rows reordered (calendar → preference → structure); Top provider restored (messages-weighted, All view only) and Tools per message removed.
27
+ - Command Center items renamed: Open Activity (all providers) → Activity, Activity → Agent Activity.
28
+ - Heatmap title renamed from Tool activity to Activity.
29
+ - Smaller headings and tighter section spacing across the global surface and heatmap.
30
+ - Explorer Activity panel: header removed (branch / workspace name and Today / 7D / 30D / All chips) so KPIs cover the workspace's full history; denser KPIs (shell / file reads / file writes / messages only); Active agent rows open the conversation from anywhere in the row; agent display menu (floating card below the header icon with hover flyout submenus matching the host sidebar menu; sort by updated / created / name / messages / status with attention-worthy agents first; group by None / Provider / Status; multi-select Status Active / Archived and Lifecycle Idle / Running / Error / Closed; Show toggles for provider / calls / messages / updated; `usage.agents` returns `updatedAt` and `archivedAt`); Command Center item Workspace Activity opens the panel in the Explorer; skills / MCP share one ranked list toggled by the header icon; hidden scrollbars avoid layout shift when filters change.
31
+ - Explorer Agents display preferences (Sort / Group / Show / Status / Lifecycle) persist across workspaces, plugin reloads, and daemon restarts in host-scoped `explorer-agent-display` settings; defaults are sort Updated, group None, Status Active, all lifecycles, no extra Show fields.
32
+ - Workspace Activity panel split into `client/workspace/` modules; Workspace Messages KPI reads `usage.summary.messageCount`.
33
+
34
+ ### Removed
35
+
36
+ - Command Center Export activity report item; the `usage.export` RPC stays available.
37
+
38
+ ### Fixed
39
+
40
+ - Heatmap keeps its 52-week layout for Today / 7D / 30D ranges.
41
+ - Hardened heatmap color mixing against invalid theme color values.
42
+
43
+ ## [0.1.0] - 2026-09-19
44
+
45
+ ### Added
46
+
47
+ - Initial release: local SQLite-backed usage analytics for tools, agents, messages, and models.
48
+ - Timeline ingestion with silent historical backfill; queries read the local database only.
49
+ - Composer pill, agent workspace panel, and Activity sidebar (global view grouped by provider).
50
+ - Heatmap, KPIs, insights, most used models, and a provider filter limited to the top 5.
51
+ - Command Center entries: open panels and export a markdown usage report.
52
+ - Plugin renamed from `tool-usage` to `activity`, migrating the old data directory automatically.
53
+
54
+ [Unreleased]: https://github.com/koinzhang/paseo-plugins/compare/activity-v0.2.0...HEAD
55
+ [0.2.0]: https://github.com/koinzhang/paseo-plugins/releases/tag/activity-v0.2.0
56
+ [0.1.0]: https://github.com/koinzhang/paseo-plugins/releases/tag/activity-v0.1.0
package/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # Activity
2
+
3
+ Local usage analytics for Paseo: tool calls, agents, messages, and model usage.
4
+
5
+ Activity ingests every agent's Paseo timeline into a local SQLite database and answers "how am I / each provider actually using Paseo". Queries read the local database; the Paseo timeline and `agents.list` are ingestion and backfill sources only.
6
+
7
+ | Dimension | What is counted |
8
+ |---|---|
9
+ | Tools | Skill / MCP / shell / file calls; skills classified into exact / inferred / low confidence tiers |
10
+ | Agents | Every created agent (registry with archive metadata) |
11
+ | Messages | User-sent messages |
12
+ | Models | Model at send time (weighted by messages) |
13
+
14
+ ## Where it shows up
15
+
16
+ - **Composer pill** — current agent's skill / MCP summary, hidden when there is no data
17
+ - **Agent workspace panel** — per-agent detail (KPI / Skills / MCP / SKILL.md reader)
18
+ - **Activity sidebar** — global view grouped by provider; heatmap, KPIs, insights, most used
19
+ - **Command Center** — open panels, export a markdown usage report
20
+
21
+ ## Data
22
+
23
+ Everything lives on the daemon machine in `~/.paseo/plugin-data/activity/` (SQLite `usage.db`). Nothing is sent anywhere.
24
+
25
+ ## Install
26
+
27
+ Requires Paseo >= 0.8.0.
28
+
29
+ From Git (Paseo 0.8 and later):
30
+
31
+ ```bash
32
+ paseo plugin add koinzhang/paseo-plugins --path activity
33
+ ```
34
+
35
+ From npm (Paseo 0.9 and later; this is the source paseo.cafe hands to Paseo 0.9+):
36
+
37
+ ```bash
38
+ paseo plugin install npm:@koinzhang/paseo-plugin-activity
39
+ ```
40
+
41
+ After source changes, reload and check status:
42
+
43
+ ```bash
44
+ paseo plugin reload activity
45
+ paseo plugin logs activity
46
+ paseo plugin ls
47
+ ```
48
+
49
+ ## Limitations
50
+
51
+ - Analytics are local to each daemon: every machine keeps its own database, and there is no cross-host aggregation.
52
+ - Numbers are reconstructed from the Paseo timeline; items that do not report a model or skill cannot be attributed for that dimension.
53
+ - Skill classification is heuristic (exact / inferred / low confidence); check the tier before trusting a count.
54
+
55
+ ## Development
56
+
57
+ ```bash
58
+ npm install
59
+ npm run typecheck
60
+ npm test
61
+ ```
62
+
63
+ This plugin is spec-driven: read [specs/README.md](./specs/README.md) before coding, then the matching numbered directory.
64
+
65
+ ## Publish
66
+
67
+ Release history: [CHANGELOG.md](./CHANGELOG.md). 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).
68
+
69
+ ## License
70
+
71
+ [MIT](../LICENSE) © koinzhang
@@ -10,18 +10,23 @@ type ThemeColors = {
10
10
  surface0: string; surface1: string; surface2: string;
11
11
  };
12
12
 
13
+ type HoveredMonth = { year: number; month: number };
14
+
13
15
  // Derive the activity palette from the active theme.
14
16
  function mix(base: string, accent: string, amount: number): string {
15
- const parse = (value: string) => {
16
- const hex = value.replace("#", "");
17
+ const parse = (value: string): number[] | null => {
18
+ const hex = value.replace("#", "").trim();
17
19
  const expanded = hex.length === 3 || hex.length === 4
18
20
  ? hex.split("").map((c) => c + c).join("")
19
21
  : hex;
20
22
  // Use first 6 digits only — ignore trailing alpha on 8-digit hex.
21
23
  const rgb = expanded.slice(0, 6);
24
+ if (!/^[0-9a-fA-F]{6}$/.test(rgb)) return null;
22
25
  return [0, 2, 4].map((i) => parseInt(rgb.slice(i, i + 2), 16));
23
26
  };
24
- const a = parse(base); const b = parse(accent);
27
+ const a = parse(base);
28
+ const b = parse(accent);
29
+ if (!a || !b) return base;
25
30
  return `rgb(${a.map((v, i) => Math.round(v + (b[i]! - v) * amount)).join(",")})`;
26
31
  }
27
32
 
@@ -29,6 +34,12 @@ function plural(count: number, singular: string, pluralForm = `${singular}s`): s
29
34
  return `${count.toLocaleString()} ${count === 1 ? singular : pluralForm}`;
30
35
  }
31
36
 
37
+ function cellInMonth(dateKey: string, hovered: HoveredMonth | null): boolean {
38
+ if (!hovered) return false;
39
+ const [year, month] = dateKey.split("-").map(Number);
40
+ return year === hovered.year && month === hovered.month + 1;
41
+ }
42
+
32
43
  export function ActivityHeatmap({ days, from, colors, compact, mode, onModeChange, modeOptions }: {
33
44
  days: readonly ActivityDay[]; from?: string; colors: ThemeColors; compact?: boolean;
34
45
  mode: HeatmapMode; onModeChange: (mode: HeatmapMode) => void;
@@ -41,7 +52,12 @@ export function ActivityHeatmap({ days, from, colors, compact, mode, onModeChang
41
52
  const [tooltipSize, setTooltipSize] = useState({ width: 220, height: 28 });
42
53
  const [selected, setSelected] = useState<string | null>(null);
43
54
  const [hovered, setHovered] = useState<string | null>(null);
44
- useEffect(() => { setSelected(null); setHovered(null); }, [from, mode, days]);
55
+ const [hoveredMonth, setHoveredMonth] = useState<HoveredMonth | null>(null);
56
+ useEffect(() => {
57
+ setSelected(null);
58
+ setHovered(null);
59
+ setHoveredMonth(null);
60
+ }, [from, mode, days]);
45
61
  const { weeks, months, max } = useMemo(() => buildActivityCalendar(days, mode, from, new Date(), locale), [days, mode, from, locale]);
46
62
  const gap = compact ? 2 : 3;
47
63
  // Fit the full year into the measured width (no min floor — avoid horizontal overflow).
@@ -69,13 +85,13 @@ export function ActivityHeatmap({ days, from, colors, compact, mode, onModeChang
69
85
  const tooltipText = active
70
86
  ? `${plural(active.skills, "skill")}, ${plural(active.mcp, "mcp")}, ${plural(active.agents, "agent")}, ${plural(active.messages, "message")} ${datePrefix} ${dateLabel}`
71
87
  : "";
72
- const muted = { color: colors.foregroundMuted, fontSize: 12 };
73
88
  const axisWidth = needsScroll ? gridWidth : width;
74
89
  const modeLabel = mode === "weekly" ? "Week containing" : mode === "cumulative" ? "Through" : "";
90
+ const monthFocus = hoveredMonth != null;
75
91
  return (
76
- <View style={{ gap: compact ? 16 : 22 }} onLayout={event => setWidth(event.nativeEvent.layout.width)}>
92
+ <View style={{ gap: compact ? 10 : 12 }} onLayout={event => setWidth(event.nativeEvent.layout.width)}>
77
93
  <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", justifyContent: "space-between", gap: 12 }}>
78
- <Text style={{ color: colors.foreground, fontSize: compact ? 17 : 20, fontWeight: "500" }}>Tool activity</Text>
94
+ <Text style={{ color: colors.foreground, fontSize: compact ? 13 : 15, fontWeight: "500" }}>Activity</Text>
79
95
  <View style={{ flexDirection: "row", gap: compact ? 14 : 20 }}>
80
96
  {modeOptions.map(option => (
81
97
  <Pressable key={option.id} accessibilityRole="tab" accessibilityState={{ selected: mode === option.id }} onPress={() => onModeChange(option.id)} style={{ paddingVertical: 6 }}>
@@ -98,6 +114,22 @@ export function ActivityHeatmap({ days, from, colors, compact, mode, onModeChang
98
114
  <View key={i} style={{ gap }}>
99
115
  {week.map(cell => {
100
116
  const hidden = cell.future || cell.excluded;
117
+ const inMonth = cellInMonth(cell.key, hoveredMonth);
118
+ const level = activityLevel(cell.total, max);
119
+ const base = palette[level]!;
120
+ // Focus = leave target month as-is; gently mute others toward surface2
121
+ // (same space as empty cells — preserves activity hue, avoids surface0 parse issues).
122
+ const fill =
123
+ hidden
124
+ ? base
125
+ : monthFocus && inMonth
126
+ ? mix(base, colors.accent, 0.04)
127
+ : base;
128
+ const opacity = hidden
129
+ ? 0
130
+ : monthFocus && !inMonth
131
+ ? 0.64
132
+ : 1;
101
133
  return (
102
134
  <Pressable key={cell.key} disabled={hidden} accessibilityRole="button"
103
135
  accessibilityLabel={`${modeLabel} ${cell.key}: ${cell.total} activity, ${cell.skills} skills, ${cell.mcp} MCP, ${cell.agents} agents, ${cell.messages} messages`}
@@ -105,19 +137,45 @@ export function ActivityHeatmap({ days, from, colors, compact, mode, onModeChang
105
137
  onHoverIn={() => setHovered(cell.key)} onHoverOut={() => setHovered(null)}
106
138
  onFocus={() => setHovered(cell.key)} onBlur={() => setHovered(null)}
107
139
  onPress={() => setSelected(prev => prev === cell.key ? null : cell.key)}
108
- style={{ width: cellSize, height: cellSize, borderRadius: Math.max(2, cellSize / 4),
109
- backgroundColor: palette[activityLevel(cell.total, max)], opacity: hidden ? 0 : 1 }} />
140
+ style={{
141
+ width: cellSize,
142
+ height: cellSize,
143
+ borderRadius: Math.max(2, cellSize / 4),
144
+ backgroundColor: fill,
145
+ opacity,
146
+ }} />
110
147
  );
111
148
  })}
112
149
  </View>
113
150
  ))}
114
151
  </View>
115
152
  <View style={{ height: 24, marginTop: 10, flexDirection: "row", justifyContent: "space-between" }}>
116
- {months.map((item, i) => (
117
- <Text key={`${item.label}-${i}`} numberOfLines={1} style={muted}>
118
- {item.label}
119
- </Text>
120
- ))}
153
+ {months.map((item, i) => {
154
+ const activeMonth =
155
+ hoveredMonth?.year === item.year && hoveredMonth.month === item.month;
156
+ return (
157
+ <Pressable
158
+ key={`${item.year}-${item.month}-${i}`}
159
+ accessibilityRole="button"
160
+ accessibilityLabel={`Highlight ${item.label}`}
161
+ onHoverIn={() => setHoveredMonth({ year: item.year, month: item.month })}
162
+ onHoverOut={() => setHoveredMonth(null)}
163
+ onFocus={() => setHoveredMonth({ year: item.year, month: item.month })}
164
+ onBlur={() => setHoveredMonth(null)}
165
+ style={{ paddingVertical: 2 }}
166
+ >
167
+ <Text
168
+ numberOfLines={1}
169
+ style={{
170
+ color: activeMonth ? colors.foreground : colors.foregroundMuted,
171
+ fontSize: 12,
172
+ }}
173
+ >
174
+ {item.label}
175
+ </Text>
176
+ </Pressable>
177
+ );
178
+ })}
121
179
  </View>
122
180
  </View>
123
181
  </ScrollView>
@@ -29,8 +29,7 @@ import { mcpServerColor } from "./rank-color.ts";
29
29
  import { selectProviderOptions } from "./provider-filter.ts";
30
30
  import { useAppLanguage } from "./use-app-language.ts";
31
31
  import { buildActivityInsights, ACTIVITY_LIST_LIMIT } from "../shared/insights.ts";
32
-
33
- type RangeId = "all" | "7d" | "30d" | "today";
32
+ import { rangeFrom, RANGE_OPTIONS, type RangeId } from "./range.ts";
34
33
 
35
34
  /** Max rows for Activity insights and Most used skills / MCP. */
36
35
  const LIST_LIMIT = ACTIVITY_LIST_LIMIT;
@@ -52,6 +51,8 @@ function emptyProviderUsage(provider: string, label?: string): ProviderUsageItem
52
51
  shellTop: [],
53
52
  models: [],
54
53
  agentCount: 0,
54
+ codingAgentCount: 0,
55
+ chatAgentCount: 0,
55
56
  workspaceCount: 0,
56
57
  messageCount: 0,
57
58
  callCount: 0,
@@ -60,17 +61,6 @@ function emptyProviderUsage(provider: string, label?: string): ProviderUsageItem
60
61
 
61
62
 
62
63
 
63
- function rangeFrom(id: RangeId): string | undefined {
64
- if (id === "all") return undefined;
65
- if (id === "today") {
66
- const d = new Date();
67
- d.setHours(0, 0, 0, 0);
68
- return d.toISOString();
69
- }
70
- const days = id === "7d" ? 7 : 30;
71
- return new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString();
72
- }
73
-
74
64
  function formatCount(value: number): string {
75
65
  if (value >= 1_000_000) return `${(value / 1_000_000).toFixed(1).replace(/\.0$/, "")}M`;
76
66
  if (value >= 10_000) return `${(value / 1_000).toFixed(1).replace(/\.0$/, "")}k`;
@@ -405,6 +395,8 @@ export function GlobalUsageSurface({ theme, layout }: PluginSurfaceProps) {
405
395
  let fileReads = 0;
406
396
  let fileWrites = 0;
407
397
  let agents = 0;
398
+ let codingAgents = 0;
399
+ let chatAgents = 0;
408
400
  let messages = 0;
409
401
  for (const item of filteredProviders) {
410
402
  skills += item.skillCalls.exact + item.skillCalls.inferred;
@@ -413,13 +405,26 @@ export function GlobalUsageSurface({ theme, layout }: PluginSurfaceProps) {
413
405
  fileReads += item.fileReads;
414
406
  fileWrites += item.fileWrites;
415
407
  agents += item.agentCount;
408
+ codingAgents += item.codingAgentCount;
409
+ chatAgents += item.chatAgentCount;
416
410
  messages += item.messageCount;
417
411
  }
418
412
  const workspaces =
419
413
  providerFilter === "all"
420
414
  ? (query.data?.totals.workspaceCount ?? 0)
421
415
  : (filteredProviders[0]?.workspaceCount ?? 0);
422
- return { skills, mcp, shell, fileReads, fileWrites, agents, messages, workspaces };
416
+ return {
417
+ skills,
418
+ mcp,
419
+ shell,
420
+ fileReads,
421
+ fileWrites,
422
+ agents,
423
+ codingAgents,
424
+ chatAgents,
425
+ messages,
426
+ workspaces,
427
+ };
423
428
  }, [filteredProviders, providerFilter, query.data?.totals.workspaceCount]);
424
429
 
425
430
  const streaks = useMemo(
@@ -435,9 +440,8 @@ export function GlobalUsageSurface({ theme, layout }: PluginSurfaceProps) {
435
440
  mcp: summary.mcp,
436
441
  agents: summary.agents,
437
442
  messages: summary.messages,
438
- shell: summary.shell,
439
- fileReads: summary.fileReads,
440
- fileWrites: summary.fileWrites,
443
+ codingAgents: summary.codingAgents,
444
+ chatAgents: summary.chatAgents,
441
445
  longestStreak: streaks.longest,
442
446
  },
443
447
  providers: filteredProviders,
@@ -468,7 +472,7 @@ export function GlobalUsageSurface({ theme, layout }: PluginSurfaceProps) {
468
472
  content: {
469
473
  padding,
470
474
  paddingBottom: padding + 32,
471
- gap: layout.compact ? 28 : 40,
475
+ gap: layout.compact ? 24 : 32,
472
476
  maxWidth: 780,
473
477
  width: "100%" as const,
474
478
  alignSelf: "center" as const,
@@ -518,7 +522,7 @@ export function GlobalUsageSurface({ theme, layout }: PluginSurfaceProps) {
518
522
  },
519
523
  blockTitle: {
520
524
  color: theme.colors.foreground,
521
- fontSize: 19,
525
+ fontSize: layout.compact ? 13 : 15,
522
526
  fontWeight: "500" as const,
523
527
  flexShrink: 1,
524
528
  marginBottom: 0,
@@ -593,12 +597,7 @@ export function GlobalUsageSurface({ theme, layout }: PluginSurfaceProps) {
593
597
  <ScrollView style={styles.screen} contentContainerStyle={styles.content}>
594
598
  <View style={styles.filterRow}>
595
599
  <TextTabs
596
- options={[
597
- { id: "all", label: "All time" },
598
- { id: "today", label: "Today" },
599
- { id: "7d", label: "7 days" },
600
- { id: "30d", label: "30 days" },
601
- ]}
600
+ options={RANGE_OPTIONS}
602
601
  value={range}
603
602
  onChange={(id) => setRange(id as RangeId)}
604
603
  styles={styles}
package/client/panel.tsx CHANGED
@@ -312,6 +312,7 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
312
312
  { label: "Shell calls", value: (usageSummary.data?.shellCalls ?? 0).toLocaleString() },
313
313
  { label: "File reads", value: (usageSummary.data?.fileReads ?? 0).toLocaleString() },
314
314
  { label: "File writes", value: (usageSummary.data?.fileWrites ?? 0).toLocaleString() },
315
+ { label: "Messages", value: (usageSummary.data?.messageCount ?? 0).toLocaleString() },
315
316
  { label: "Tools explored", value: String(skillItems.length + mcpItems.length) },
316
317
  ]} /> : null}
317
318
  {tabs.length > 1 ? (
@@ -0,0 +1,20 @@
1
+ export type RangeId = "all" | "7d" | "30d" | "today";
2
+
3
+ export const RANGE_OPTIONS: ReadonlyArray<{ id: RangeId; label: string }> = [
4
+ { id: "all", label: "All time" },
5
+ { id: "today", label: "Today" },
6
+ { id: "7d", label: "7 days" },
7
+ { id: "30d", label: "30 days" },
8
+ ];
9
+
10
+ /** Inclusive lower bound ISO timestamp for a range chip; undefined = all time. */
11
+ export function rangeFrom(id: RangeId): string | undefined {
12
+ if (id === "all") return undefined;
13
+ if (id === "today") {
14
+ const d = new Date();
15
+ d.setHours(0, 0, 0, 0);
16
+ return d.toISOString();
17
+ }
18
+ const days = id === "7d" ? 7 : 30;
19
+ return new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString();
20
+ }
@@ -1,16 +1,18 @@
1
1
  import { Text, View } from "react-native";
2
2
 
3
- export function UsageStats({ items, colors, compact }: {
3
+ export function UsageStats({ items, colors, compact, dense }: {
4
4
  items: ReadonlyArray<{ label: string; value: string }>;
5
5
  colors: { border: string; foreground: string; foregroundMuted: string };
6
6
  compact: boolean;
7
+ /** Smaller numbers / labels / padding (025). */
8
+ dense?: boolean;
7
9
  }) {
8
10
  return (
9
- <View style={{ flexDirection: "row", flexWrap: "wrap", borderWidth: 1, borderColor: colors.border, borderRadius: 20, paddingVertical: compact ? 8 : 18, rowGap: 16 }}>
11
+ <View style={{ flexDirection: "row", flexWrap: "wrap", borderWidth: 1, borderColor: colors.border, borderRadius: 20, paddingVertical: dense ? 6 : compact ? 8 : 18, rowGap: dense ? 10 : 16 }}>
10
12
  {items.map((item, index) => (
11
- <View key={item.label} style={{ flexGrow: 1, flexBasis: compact ? 100 : 120, minWidth: 0, alignItems: "center", paddingHorizontal: 12, paddingVertical: 4, gap: 6, borderLeftWidth: index === 0 || compact ? 0 : 1, borderLeftColor: colors.border }}>
12
- <Text style={{ color: colors.foreground, fontSize: compact ? 20 : 24, fontWeight: "500", fontVariant: ["tabular-nums"] }}>{item.value}</Text>
13
- <Text style={{ color: colors.foregroundMuted, fontSize: compact ? 12 : 14 }}>{item.label}</Text>
13
+ <View key={item.label} style={{ flexGrow: 1, flexBasis: dense ? 84 : compact ? 100 : 120, minWidth: 0, alignItems: "center", paddingHorizontal: dense ? 8 : 12, paddingVertical: dense ? 2 : 4, gap: dense ? 4 : 6, borderLeftWidth: index === 0 || compact ? 0 : 1, borderLeftColor: colors.border }}>
14
+ <Text style={{ color: colors.foreground, fontSize: dense ? 17 : compact ? 20 : 24, fontWeight: "500", fontVariant: ["tabular-nums"] }}>{item.value}</Text>
15
+ <Text style={{ color: colors.foregroundMuted, fontSize: dense ? 11 : compact ? 12 : 14 }}>{item.label}</Text>
14
16
  </View>
15
17
  ))}
16
18
  </View>
@@ -0,0 +1,117 @@
1
+ import { Icon } from "@getpaseo/plugin/client/react-native";
2
+ import { useState, type ReactNode } from "react";
3
+ import {
4
+ ActivityIndicator,
5
+ Platform,
6
+ Pressable,
7
+ Text,
8
+ View,
9
+ type TextStyle,
10
+ type ViewStyle,
11
+ } from "react-native";
12
+ import type { WorkspaceTheme } from "./constants.ts";
13
+
14
+ export type AgentRowStyles = {
15
+ agentListRow: ViewStyle;
16
+ listMain: ViewStyle;
17
+ listLink: TextStyle;
18
+ listTitle: TextStyle;
19
+ listMeta: TextStyle;
20
+ titleAction: ViewStyle;
21
+ };
22
+
23
+ export function AgentRow({
24
+ label,
25
+ archived,
26
+ canOpen,
27
+ meta,
28
+ busy,
29
+ actionDisabled,
30
+ theme,
31
+ styles,
32
+ onOpen,
33
+ onArchiveToggle,
34
+ }: {
35
+ label: string;
36
+ archived: boolean;
37
+ canOpen: boolean;
38
+ meta: string | null;
39
+ busy: boolean;
40
+ actionDisabled: boolean;
41
+ theme: WorkspaceTheme;
42
+ styles: AgentRowStyles;
43
+ onOpen: () => void;
44
+ onArchiveToggle: () => void;
45
+ }): ReactNode {
46
+ const [hovered, setHovered] = useState(false);
47
+ // Web: hover-reveal. Native has no hover — keep the action visible.
48
+ // mouseenter/leave (not nested Pressable hover) so title/action don't flicker.
49
+ const showAction = Platform.OS !== "web" || hovered || busy;
50
+ const hoverProps =
51
+ Platform.OS === "web"
52
+ ? ({
53
+ onMouseEnter: () => setHovered(true),
54
+ onMouseLeave: () => setHovered(false),
55
+ } as object)
56
+ : null;
57
+
58
+ const body = (
59
+ <>
60
+ <Icon
61
+ name={archived ? "BotOff" : "Bot"}
62
+ size={18}
63
+ color={theme.colors.foregroundMuted}
64
+ />
65
+ <View style={styles.listMain}>
66
+ <Text style={canOpen ? styles.listLink : styles.listTitle} numberOfLines={1}>
67
+ {label}
68
+ </Text>
69
+ {meta ? (
70
+ <Text style={styles.listMeta} numberOfLines={1}>
71
+ {meta}
72
+ </Text>
73
+ ) : null}
74
+ </View>
75
+ <Pressable
76
+ accessibilityRole="button"
77
+ accessibilityLabel={archived ? `Unarchive ${label}` : `Archive ${label}`}
78
+ accessibilityState={{ disabled: actionDisabled }}
79
+ disabled={actionDisabled || !showAction}
80
+ hitSlop={8}
81
+ onPress={onArchiveToggle}
82
+ pointerEvents={showAction ? "auto" : "none"}
83
+ style={[styles.titleAction, { opacity: showAction ? 1 : 0 }]}
84
+ >
85
+ {busy ? (
86
+ <ActivityIndicator size="small" color={theme.colors.foregroundMuted} />
87
+ ) : (
88
+ <Icon
89
+ name={archived ? "ArchiveRestore" : "Archive"}
90
+ size={14}
91
+ color={theme.colors.foregroundMuted}
92
+ />
93
+ )}
94
+ </Pressable>
95
+ </>
96
+ );
97
+
98
+ if (canOpen) {
99
+ return (
100
+ <Pressable
101
+ accessibilityRole="link"
102
+ accessibilityLabel={`Open conversation ${label}`}
103
+ onPress={onOpen}
104
+ style={styles.agentListRow}
105
+ {...hoverProps}
106
+ >
107
+ {body}
108
+ </Pressable>
109
+ );
110
+ }
111
+
112
+ return (
113
+ <View style={styles.agentListRow} {...hoverProps}>
114
+ {body}
115
+ </View>
116
+ );
117
+ }