@koinzhang/paseo-plugin-activity 0.6.0 → 0.8.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 (68) hide show
  1. package/CHANGELOG.md +50 -1
  2. package/README.md +18 -11
  3. package/client/activity-heatmap.tsx +115 -74
  4. package/client/agent-creations.tsx +100 -90
  5. package/client/attention-pill.tsx +17 -6
  6. package/client/attention-popover.tsx +19 -23
  7. package/client/design-tokens.test.ts +39 -0
  8. package/client/design-tokens.ts +180 -0
  9. package/client/formatted-time.tsx +4 -4
  10. package/client/global-surface.tsx +243 -268
  11. package/client/header-button.ts +136 -0
  12. package/client/hourly-activity-timeline.tsx +153 -103
  13. package/client/panel-visibility.test.ts +25 -0
  14. package/client/panel-visibility.ts +45 -0
  15. package/client/panel.tsx +94 -111
  16. package/client/pill.tsx +1 -1
  17. package/client/provider-dropdown.tsx +134 -0
  18. package/client/provider-filter.test.ts +17 -13
  19. package/client/provider-filter.ts +5 -7
  20. package/client/rank-color.ts +3 -3
  21. package/client/ranking-bars.tsx +294 -0
  22. package/client/sidebar-item.tsx +15 -0
  23. package/client/ui.tsx +351 -0
  24. package/client/usage-popover.tsx +72 -137
  25. package/client/usage-stats.tsx +29 -11
  26. package/client/use-agent-turn-end.ts +2 -1
  27. package/client/use-app-language.ts +17 -0
  28. package/client/web.ts +73 -18
  29. package/client/workspace/agent-row.tsx +28 -28
  30. package/client/workspace/agents-section.tsx +42 -57
  31. package/client/workspace/constants.ts +8 -6
  32. package/client/workspace/display-menu.tsx +6 -5
  33. package/client/workspace/filters.test.ts +1 -1
  34. package/client/workspace/filters.ts +4 -2
  35. package/client/workspace/panel.tsx +96 -104
  36. package/client/workspace/rank-section.tsx +40 -65
  37. package/client/workspace/running-indicator.tsx +1 -1
  38. package/client/workspace/terminals-section.tsx +24 -12
  39. package/index.client.tsx +53 -31
  40. package/index.server.ts +55 -73
  41. package/package.json +3 -3
  42. package/paseo-plugin.json +2 -1
  43. package/server/agents.ts +20 -2
  44. package/server/background-sync.ts +34 -4
  45. package/server/handlers-query.test.ts +27 -1
  46. package/server/handlers.ts +75 -31
  47. package/server/host-types.ts +6 -6
  48. package/server/ingest.test.ts +8 -0
  49. package/server/messages.test.ts +96 -1
  50. package/server/prompt-dedupe.ts +52 -0
  51. package/server/rpc-cache.test.ts +74 -0
  52. package/server/rpc-cache.ts +48 -0
  53. package/server/store.test.ts +122 -0
  54. package/server/store.ts +313 -19
  55. package/server/ttl-cache.ts +3 -0
  56. package/server/turn-ingest.test.ts +180 -0
  57. package/server/turn-ingest.ts +71 -0
  58. package/shared/activity.test.ts +36 -0
  59. package/shared/activity.ts +37 -0
  60. package/shared/classify.test.ts +1 -10
  61. package/shared/classify.ts +3 -10
  62. package/shared/format.ts +10 -7
  63. package/shared/i18n.test.ts +34 -0
  64. package/shared/i18n.ts +363 -0
  65. package/shared/insights.test.ts +120 -81
  66. package/shared/insights.ts +125 -64
  67. package/shared/usage.test.ts +121 -0
  68. package/shared/usage.ts +191 -2
@@ -1,16 +1,23 @@
1
- import { useEffect, useMemo, useState } from "react";
2
- import { Pressable, Text, View } from "react-native";
1
+ import { useEffect, useMemo, useRef, useState } from "react";
2
+ import { Animated, Easing, Pressable, Text, View } from "react-native";
3
3
  import {
4
4
  buildAgentCreationBuckets,
5
+ buildDailyMetricBuckets,
5
6
  rankCreationProviders,
6
7
  stackCreationProviders,
7
8
  type CreationBucket,
9
+ type ActivityMetric,
8
10
  type CreationProviderSlice,
9
11
  } from "../shared/activity.ts";
10
- import type { AgentCreationDay } from "../shared/usage.ts";
12
+ import type { ActivityDay, AgentCreationDay } from "../shared/usage.ts";
11
13
  import { creationBarColor } from "./color-mix.ts";
12
14
  import { chartColorScheme, creationProviderColors } from "./rank-color.ts";
13
15
  import { fixedWindowFrom } from "./range.ts";
16
+ import { CHART_MOTION, PRESS, RADIUS, TEXT, sectionTitle, titleGap } from "./design-tokens.ts";
17
+ import { messagesFor } from "../shared/i18n.ts";
18
+ import { ChartTooltip, InlineEmpty, MetricStepper } from "./ui.tsx";
19
+
20
+ const EMPTY_BAR_HEIGHT = 2;
14
21
 
15
22
  type ThemeColors = {
16
23
  accent: string;
@@ -31,39 +38,40 @@ function dayLabel(key: string, locale: string): string {
31
38
  return bucketDate(key).toLocaleDateString(locale, { month: "short", day: "numeric" });
32
39
  }
33
40
 
34
- function agentCountText(count: number): string {
35
- return `${count} ${count === 1 ? "agent" : "agents"}`;
36
- }
37
-
38
41
  /**
39
- * Agent creations per local day over a fixed window (051 / 057): the last
40
- * `windowDays` days ending today, independent of the range chips. Each day is
41
- * one accent-intensity bar (057); hovering shows a provider breakdown card
42
- * (nonzero that day only, 056) with brand-coloured chips and the date.
42
+ * Daily bars over a fixed window (051 / 057): the last `windowDays` days
43
+ * ending today. Each day is one accent-intensity bar (057). The header switch
44
+ * (070) picks the metric; Sessions hovers show a provider breakdown card
45
+ * (nonzero that day only, 056), other metrics come from `activityDays` and
46
+ * show the day total only.
43
47
  */
44
- export function AgentCreations({ days, windowDays, colors, compact, locale }: {
48
+ export function AgentCreations({ days, activityDays, windowDays, colors, compact, locale }: {
45
49
  days: readonly AgentCreationDay[];
50
+ activityDays: readonly ActivityDay[];
46
51
  windowDays: number;
47
52
  colors: ThemeColors;
48
53
  compact?: boolean;
49
54
  locale: string;
50
55
  }) {
56
+ const [metric, setMetric] = useState<ActivityMetric>("sessions");
51
57
  const from = fixedWindowFrom(windowDays);
52
58
  const buckets = useMemo(
53
- () => buildAgentCreationBuckets(days, { from }),
54
- [days, from],
59
+ () =>
60
+ metric === "sessions"
61
+ ? buildAgentCreationBuckets(days, { from })
62
+ : buildDailyMetricBuckets(activityDays, metric, { from }),
63
+ [days, activityDays, metric, from],
55
64
  );
56
65
  const providers = useMemo(() => rankCreationProviders(buckets), [buckets]);
57
66
  const [hovered, setHovered] = useState<string | null>(null);
58
67
  const [selected, setSelected] = useState<string | null>(null);
59
68
  const [width, setWidth] = useState(0);
60
- const [tooltipSize, setTooltipSize] = useState({ width: 150, height: 0 });
61
69
  useEffect(() => {
62
70
  setHovered(null);
63
71
  setSelected(null);
64
72
  // Only the window start invalidates the selection: refetching the same
65
73
  // window must not close a tooltip the pointer is resting on (051).
66
- }, [from]);
74
+ }, [from, metric]);
67
75
 
68
76
  const activeKey = hovered ?? selected;
69
77
  const total = buckets.reduce((sum, bucket) => sum + bucket.count, 0);
@@ -74,7 +82,6 @@ export function AgentCreations({ days, windowDays, colors, compact, locale }: {
74
82
  const gap = compact ? 2 : 3;
75
83
  const slot = buckets.length > 0 ? (width + gap) / buckets.length : 0;
76
84
  const anchorX = activeIndex >= 0 ? activeIndex * slot + (slot - gap) / 2 : 0;
77
- const tooltipLeft = Math.max(0, Math.min(anchorX - tooltipSize.width / 2, width - tooltipSize.width));
78
85
  const scheme = chartColorScheme(colors.surface0);
79
86
  const colorByProvider = creationProviderColors(
80
87
  providers.map((item) => item.provider),
@@ -84,17 +91,27 @@ export function AgentCreations({ days, windowDays, colors, compact, locale }: {
84
91
  ? stackCreationProviders(providers, active.providers)
85
92
  : [];
86
93
  const first = buckets[0];
94
+ const m = messagesFor(locale);
95
+ const unit = (count: number) =>
96
+ metric === "sessions"
97
+ ? m.units.sessions(count)
98
+ : metric === "prompts"
99
+ ? m.units.prompts(count)
100
+ : metric === "skills"
101
+ ? m.units.skills(count)
102
+ : m.units.mcp(count);
87
103
 
88
104
  return (
89
- <View style={{ gap: compact ? 10 : 12 }}>
90
- <Text style={{ color: colors.foreground, fontSize: compact ? 13 : 15, fontWeight: "500" }}>
91
- Agents
92
- </Text>
105
+ <View style={{ gap: titleGap(compact) }}>
106
+ <View style={{ flexDirection: "row", alignItems: "center", justifyContent: "space-between", gap: 12 }}>
107
+ <Text style={{ ...sectionTitle(compact), color: colors.foreground }}>
108
+ {m.creations.title}
109
+ </Text>
110
+ <MetricStepper value={metric} onChange={setMetric} colors={colors} />
111
+ </View>
93
112
 
94
113
  {total === 0 ? (
95
- <Text style={{ color: colors.foregroundMuted, fontSize: 14 }}>
96
- No agents created in the last {windowDays} days
97
- </Text>
114
+ <InlineEmpty text={m.creations.empty(windowDays)} color={colors.foregroundMuted} />
98
115
  ) : (
99
116
  <View style={{ gap: 6 }}>
100
117
  <View style={{ position: "relative" }} onLayout={(event) => setWidth(event.nativeEvent.layout.width)}>
@@ -103,92 +120,58 @@ export function AgentCreations({ days, windowDays, colors, compact, locale }: {
103
120
  <Pressable
104
121
  key={bucket.key}
105
122
  accessibilityRole="button"
106
- accessibilityLabel={`${dayLabel(bucket.key, locale)}: ${agentCountText(bucket.count)}${providerBreakdown(bucket, providers)}`}
123
+ accessibilityLabel={`${dayLabel(bucket.key, locale)}: ${unit(bucket.count)}${providerBreakdown(bucket, providers)}`}
107
124
  accessibilityState={{ selected: activeKey === bucket.key }}
108
125
  onHoverIn={() => setHovered(bucket.key)}
109
126
  onHoverOut={() => setHovered(null)}
110
127
  onFocus={() => setHovered(bucket.key)}
111
128
  onBlur={() => setHovered(null)}
112
129
  onPress={() => setSelected((prev) => (prev === bucket.key ? null : bucket.key))}
113
- style={{
130
+ style={({ pressed }) => ({
114
131
  flex: 1,
115
132
  minWidth: 3,
116
133
  height: chartHeight,
117
134
  justifyContent: "flex-end",
118
- }}
135
+ opacity: pressed ? PRESS.opacity : 1,
136
+ })}
119
137
  >
120
- {bucket.providers.length === 0 ? (
121
- <View style={{ height: 2, backgroundColor: colors.surface2 }} />
122
- ) : (
123
- <View
124
- style={{
125
- height: max > 0 ? Math.max(2, Math.round((bucket.count / max) * chartHeight)) : 2,
126
- backgroundColor: creationBarColor(
127
- bucket.count,
128
- max,
129
- colors.surface2,
130
- colors.accent,
131
- ),
132
- borderTopLeftRadius: 3,
133
- borderTopRightRadius: 3,
134
- }}
135
- />
136
- )}
138
+ <DayBar
139
+ height={
140
+ bucket.count > 0 && max > 0
141
+ ? Math.max(EMPTY_BAR_HEIGHT, Math.round((bucket.count / max) * chartHeight))
142
+ : EMPTY_BAR_HEIGHT
143
+ }
144
+ color={
145
+ bucket.count === 0
146
+ ? colors.surface2
147
+ : creationBarColor(bucket.count, max, colors.surface2, colors.accent)
148
+ }
149
+ rounded={bucket.count > 0}
150
+ />
137
151
  </Pressable>
138
152
  ))}
139
153
  </View>
140
154
  {active && width > 0 ? (
141
- <View
142
- pointerEvents="none"
143
- onLayout={(event) =>
144
- setTooltipSize({
145
- width: event.nativeEvent.layout.width,
146
- height: event.nativeEvent.layout.height,
147
- })
148
- }
149
- style={{
150
- position: "absolute",
151
- left: tooltipLeft,
152
- bottom: chartHeight + 6,
153
- zIndex: 10,
154
- paddingHorizontal: 12,
155
- paddingVertical: 8,
156
- borderRadius: 10,
157
- backgroundColor: colors.surface2,
158
- borderWidth: 1,
159
- borderColor: colors.border,
160
- gap: 4,
161
- }}
162
- >
163
- {tooltipProviders.map((item) => (
164
- <View key={item.provider} style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
165
- <View
166
- style={{
167
- width: 10,
168
- height: 10,
169
- borderRadius: 3,
170
- backgroundColor: colorByProvider.get(item.provider) ?? colors.accent,
171
- }}
172
- />
173
- <Text style={{ color: colors.foreground, fontSize: 13 }}>
174
- {item.label}: {item.count}
175
- </Text>
176
- </View>
177
- ))}
178
- <Text
179
- accessibilityLiveRegion="polite"
180
- style={{ color: colors.foregroundMuted, fontSize: 12, marginTop: 2 }}
181
- >
182
- {dayLabel(active.key, locale)}
183
- </Text>
184
- </View>
155
+ <ChartTooltip
156
+ anchorX={anchorX}
157
+ anchorY={0}
158
+ containerWidth={width}
159
+ clampTop={false}
160
+ title={`${dayLabel(active.key, locale)} · ${unit(active.count)}`}
161
+ rows={tooltipProviders.map((item) => ({
162
+ label: item.label,
163
+ value: item.count.toLocaleString(locale),
164
+ color: colorByProvider.get(item.provider) ?? colors.accent,
165
+ }))}
166
+ colors={colors}
167
+ />
185
168
  ) : null}
186
169
  </View>
187
170
  <View style={{ flexDirection: "row", justifyContent: "space-between" }}>
188
- <Text style={{ color: colors.foregroundMuted, fontSize: 12 }}>
171
+ <Text style={{ ...TEXT.meta, color: colors.foregroundMuted }}>
189
172
  {first ? dayLabel(first.key, locale) : ""}
190
173
  </Text>
191
- <Text style={{ color: colors.foregroundMuted, fontSize: 12 }}>Today</Text>
174
+ <Text style={{ ...TEXT.meta, color: colors.foregroundMuted }}>{m.common.today}</Text>
192
175
  </View>
193
176
  </View>
194
177
  )}
@@ -196,6 +179,33 @@ export function AgentCreations({ days, windowDays, colors, compact, locale }: {
196
179
  );
197
180
  }
198
181
 
182
+ /** Day column that grows from 0 on mount and animates between heights on change. */
183
+ function DayBar({ height, color, rounded }: { height: number; color: string; rounded: boolean }) {
184
+ const progress = useRef(new Animated.Value(0)).current;
185
+
186
+ useEffect(() => {
187
+ const animation = Animated.timing(progress, {
188
+ toValue: height,
189
+ duration: CHART_MOTION.grow,
190
+ easing: Easing.out(Easing.cubic),
191
+ useNativeDriver: false,
192
+ });
193
+ animation.start();
194
+ return () => animation.stop();
195
+ }, [height, progress]);
196
+
197
+ return (
198
+ <Animated.View
199
+ style={{
200
+ height: progress,
201
+ backgroundColor: color,
202
+ borderTopLeftRadius: rounded ? RADIUS.swatch : 0,
203
+ borderTopRightRadius: rounded ? RADIUS.swatch : 0,
204
+ }}
205
+ />
206
+ );
207
+ }
208
+
199
209
  function providerBreakdown(
200
210
  bucket: CreationBucket,
201
211
  ranked: readonly CreationProviderSlice[],
@@ -3,7 +3,7 @@ import {
3
3
  type PluginButtonRegistration,
4
4
  type PluginClientContext,
5
5
  } from "@getpaseo/plugin/client";
6
- import { Icon } from "@getpaseo/plugin/client/react-native";
6
+ import { Icon } from "@getpaseo/plugin/client/ui";
7
7
  import { useMemo } from "react";
8
8
  import {
9
9
  attentionPillIconName,
@@ -12,6 +12,8 @@ import {
12
12
  type AttentionAgentItem,
13
13
  } from "./attention-agents.ts";
14
14
  import { AttentionPopover } from "./attention-popover.tsx";
15
+ import { messagesFor } from "../shared/i18n.ts";
16
+ import { currentAppLanguage, watchAppLanguage } from "./use-app-language.ts";
15
17
  import {
16
18
  clearAttentionStatuses,
17
19
  getAttentionStatuses,
@@ -22,7 +24,7 @@ import { watchAgentDirectory } from "./agent-directory.ts";
22
24
  import { agentStatusInfo } from "./workspace/list-host-agents.ts";
23
25
  import type { AgentStatusInfo } from "./workspace/constants.ts";
24
26
 
25
- const TITLE = "Needs attention";
27
+ const attentionTitle = () => messagesFor(currentAppLanguage()).attention.title;
26
28
  const PILL_ID = "attention";
27
29
 
28
30
  type PillEntry = {
@@ -56,7 +58,7 @@ export function contributeAttentionPills(client: PluginClientContext): () => voi
56
58
  entry.signature = signature;
57
59
 
58
60
  if (items.length === 0) {
59
- pill.update({ visible: false, label: TITLE, disabled: false });
61
+ pill.update({ visible: false, label: attentionTitle(), disabled: false });
60
62
  return;
61
63
  }
62
64
 
@@ -64,7 +66,7 @@ export function contributeAttentionPills(client: PluginClientContext): () => voi
64
66
  pill.update({
65
67
  visible: true,
66
68
  label: String(items.length),
67
- title: TITLE,
69
+ title: attentionTitle(),
68
70
  disabled: false,
69
71
  behavior: {
70
72
  kind: "popover",
@@ -115,8 +117,8 @@ export function contributeAttentionPills(client: PluginClientContext): () => voi
115
117
  workspaceId,
116
118
  agentId,
117
119
  button: {
118
- title: TITLE,
119
- label: TITLE,
120
+ title: attentionTitle(),
121
+ label: attentionTitle(),
120
122
  visible: false,
121
123
  icon: createPillIcon(agentId),
122
124
  behavior: {
@@ -154,7 +156,16 @@ export function contributeAttentionPills(client: PluginClientContext): () => voi
154
156
  for (const [workspaceId, statuses] of workspaces) applyWorkspace(workspaceId, statuses);
155
157
  });
156
158
 
159
+ const stopLanguage = watchAppLanguage(() => {
160
+ for (const [agentId, entry] of pills) {
161
+ entry.signature = "";
162
+ const cached = getAttentionStatuses(entry.workspaceId);
163
+ if (cached) applyPill(agentId, entry, cached);
164
+ }
165
+ });
166
+
157
167
  return () => {
168
+ stopLanguage();
158
169
  stopDirectory();
159
170
  pills.forEach((entry) => entry.registration?.remove());
160
171
  pills.clear();
@@ -3,7 +3,7 @@ import {
3
3
  useAgent,
4
4
  } from "@getpaseo/plugin/client";
5
5
  import { useEffect, useMemo, type ReactNode } from "react";
6
- import { Text, View, type TextStyle, type ViewStyle } from "react-native";
6
+ import { View, type TextStyle, type ViewStyle } from "react-native";
7
7
  import {
8
8
  filterAttentionAgents,
9
9
  type AttentionAgentItem,
@@ -12,6 +12,9 @@ import { openAttentionAgent } from "./open-agent.ts";
12
12
  import { useLatestUserMessagePreview } from "./use-latest-user-message.ts";
13
13
  import { useAttentionStatuses } from "./attention-status-store.ts";
14
14
  import { AgentRow, type AgentRowStyles } from "./workspace/agent-row.tsx";
15
+ import { CONTROL, ICON_SIZE, ROW_PADDING, TEXT, pillRadius, popoverFrame } from "./design-tokens.ts";
16
+ import { useMessages } from "./use-app-language.ts";
17
+ import { InlineEmpty } from "./ui.tsx";
15
18
 
16
19
  function AttentionRow({
17
20
  item,
@@ -56,12 +59,9 @@ function AttentionRow({
56
59
 
57
60
  /** Popover body: other agents in this workspace that need attention. */
58
61
  export function AttentionPopover(props: PluginButtonContentProps) {
62
+ const m = useMessages();
59
63
  if (props.context !== "agent") {
60
- return (
61
- <Text style={{ color: props.theme.colors.foregroundMuted }}>
62
- Attention is only available for an agent
63
- </Text>
64
- );
64
+ return <InlineEmpty text={m.attention.agentOnly} color={props.theme.colors.foregroundMuted} />;
65
65
  }
66
66
  return <AttentionPopoverAgent {...props} context="agent" />;
67
67
  }
@@ -69,7 +69,8 @@ export function AttentionPopover(props: PluginButtonContentProps) {
69
69
  function AttentionPopoverAgent(
70
70
  props: PluginButtonContentProps & { context: "agent" },
71
71
  ) {
72
- const { theme, workspaceId, agentId, close } = props;
72
+ const { theme, layout, workspaceId, agentId, close } = props;
73
+ const m = useMessages();
73
74
  const statuses = useAttentionStatuses(workspaceId);
74
75
  const items = useMemo(
75
76
  () => filterAttentionAgents(statuses, agentId),
@@ -81,18 +82,17 @@ function AttentionPopoverAgent(
81
82
  flexDirection: "row",
82
83
  alignItems: "center",
83
84
  gap: 10,
84
- paddingVertical: 6,
85
+ paddingVertical: ROW_PADDING.dense,
85
86
  };
86
87
  const title: TextStyle = {
88
+ ...TEXT.rowTitle,
87
89
  color: theme.colors.foreground,
88
- fontSize: 14,
89
- fontWeight: "500",
90
90
  };
91
91
  return {
92
92
  agentListRow: row,
93
93
  agentIconWrap: {
94
- width: 18,
95
- height: 18,
94
+ width: ICON_SIZE.leading,
95
+ height: ICON_SIZE.leading,
96
96
  alignItems: "center",
97
97
  justifyContent: "center",
98
98
  } satisfies ViewStyle,
@@ -103,47 +103,43 @@ function AttentionPopoverAgent(
103
103
  listLink: title,
104
104
  listTitle: title,
105
105
  listMeta: {
106
+ ...TEXT.meta,
106
107
  color: theme.colors.foregroundMuted,
107
- fontSize: 12,
108
108
  } satisfies TextStyle,
109
109
  titleAction: { width: 0, height: 0 } satisfies ViewStyle,
110
110
  permissionBadge: {
111
111
  flexDirection: "row",
112
112
  alignItems: "center",
113
113
  gap: 3,
114
- height: 18,
114
+ height: CONTROL.pillBadgeHeight,
115
115
  paddingHorizontal: 5,
116
- borderRadius: 9,
116
+ borderRadius: pillRadius(CONTROL.pillBadgeHeight),
117
117
  borderWidth: 1,
118
118
  borderColor: theme.colors.border,
119
119
  backgroundColor: theme.colors.surface1,
120
120
  flexShrink: 0,
121
121
  } satisfies ViewStyle,
122
122
  permissionBadgeText: {
123
+ ...TEXT.pillBadge,
123
124
  color: theme.colors.statusWarning,
124
- fontSize: 11,
125
- fontWeight: "600",
126
- fontVariant: ["tabular-nums"],
127
125
  } satisfies TextStyle,
128
126
  } satisfies AgentRowStyles;
129
127
  }, [theme]);
130
128
 
131
129
  if (!statuses) {
132
130
  return (
133
- <Text style={{ color: theme.colors.foregroundMuted }}>Loading…</Text>
131
+ <InlineEmpty text={m.common.loading} color={theme.colors.foregroundMuted} />
134
132
  );
135
133
  }
136
134
 
137
135
  if (items.length === 0) {
138
136
  return (
139
- <Text style={{ color: theme.colors.foregroundMuted }}>
140
- No other agents need attention
141
- </Text>
137
+ <InlineEmpty text={m.attention.empty} color={theme.colors.foregroundMuted} />
142
138
  );
143
139
  }
144
140
 
145
141
  return (
146
- <View style={{ gap: 2, minWidth: 240 }}>
142
+ <View style={{ gap: 2, ...popoverFrame(layout.compact) }}>
147
143
  {items.map((item) => (
148
144
  <AttentionRow
149
145
  key={item.agentId}
@@ -0,0 +1,39 @@
1
+ import assert from "node:assert/strict";
2
+ import { readdirSync, readFileSync } from "node:fs";
3
+ import { join, relative } from "node:path";
4
+ import { test } from "node:test";
5
+
6
+ const CLIENT_DIR = new URL(".", import.meta.url).pathname;
7
+
8
+ const RULES: ReadonlyArray<{ name: string; pattern: RegExp }> = [
9
+ { name: "fontSize literal", pattern: /fontSize:\s*[0-9]/ },
10
+ { name: "fontWeight literal", pattern: /fontWeight:\s*["'][0-9a-z]+["']/ },
11
+ { name: "border radius literal", pattern: /[bB]order\w*Radius:\s*[0-9]/ },
12
+ { name: "Icon size literal", pattern: /<Icon\b[^>]*\bsize=\{[0-9]/ },
13
+ { name: "multi-line Icon size literal", pattern: /^\s*size=\{[0-9]+\}\s*$/ },
14
+ { name: "hitSlop literal", pattern: /hitSlop=\{[0-9]/ },
15
+ ];
16
+
17
+ function tsxFiles(dir: string): string[] {
18
+ return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
19
+ const path = join(dir, entry.name);
20
+ if (entry.isDirectory()) return tsxFiles(path);
21
+ return entry.name.endsWith(".tsx") ? [path] : [];
22
+ });
23
+ }
24
+
25
+ test("client UI uses design tokens instead of raw type / radius / icon literals (065)", () => {
26
+ const violations: string[] = [];
27
+ for (const file of tsxFiles(CLIENT_DIR)) {
28
+ readFileSync(file, "utf8")
29
+ .split("\n")
30
+ .forEach((line, index) => {
31
+ for (const rule of RULES) {
32
+ if (rule.pattern.test(line)) {
33
+ violations.push(`${relative(CLIENT_DIR, file)}:${index + 1} ${rule.name}: ${line.trim()}`);
34
+ }
35
+ }
36
+ });
37
+ }
38
+ assert.deepEqual(violations, [], "use client/design-tokens.ts (see docs/design-system.md)");
39
+ });