@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/client/panel.tsx CHANGED
@@ -1,17 +1,9 @@
1
1
  import { type PluginAgentPanelProps, useAgent, useRpc } from "@getpaseo/plugin/client";
2
2
  import { Icon } from "@getpaseo/plugin/client/react-native";
3
3
  import { useQuery, useQueryClient } from "@tanstack/react-query";
4
- import { useEffect, useMemo, useState, type ReactNode } from "react";
4
+ import { useEffect, useMemo, useState } from "react";
5
5
  import { useRegisterOpenAgent } from "./open-agent.ts";
6
- import {
7
- ActivityIndicator,
8
- Platform,
9
- Pressable,
10
- ScrollView,
11
- Text,
12
- View,
13
- type TextStyle,
14
- } from "react-native";
6
+ import { Pressable, ScrollView, Text, View } from "react-native";
15
7
  import {
16
8
  usageMcpByToolRpc,
17
9
  usageReadSkillRpc,
@@ -28,6 +20,25 @@ import {
28
20
  import { useAgentTurnEnd } from "./use-agent-turn-end.ts";
29
21
 
30
22
  import { UsageStats } from "./usage-stats.tsx";
23
+ import { useAppLanguage, useMessages } from "./use-app-language.ts";
24
+ import {
25
+ CountText,
26
+ ErrorState,
27
+ IconButton,
28
+ InlineEmpty,
29
+ LoadingState,
30
+ Section,
31
+ SectionHeader,
32
+ } from "./ui.tsx";
33
+ import {
34
+ ICON_SIZE,
35
+ RADIUS,
36
+ ROW_PADDING,
37
+ TEXT,
38
+ iconButton,
39
+ pageLayout,
40
+ sectionTitle,
41
+ } from "./design-tokens.ts";
31
42
 
32
43
  type TabId = "skills" | "mcp";
33
44
 
@@ -36,22 +47,13 @@ type SkillDetail = {
36
47
  path: string;
37
48
  };
38
49
 
39
- const MONO = Platform.select({ ios: "Menlo", default: "monospace" });
40
-
41
- function CountText({
42
- value,
43
- styles,
44
- }: {
45
- value: number | string;
46
- styles: { countText: TextStyle };
47
- }): ReactNode {
48
- return <Text style={styles.countText}>{value}</Text>;
49
- }
50
50
 
51
51
  export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPanelProps) {
52
+ const locale = useAppLanguage();
53
+ const m = useMessages();
52
54
  const [tab, setTab] = useState<TabId | null>(null);
53
55
  const [skillDetail, setSkillDetail] = useState<SkillDetail | null>(null);
54
- const padding = layout.compact ? 16 : 28;
56
+ const page = pageLayout("panel", layout.compact);
55
57
  const agentTitle = useAgent(agentId, (agent) => agent.title);
56
58
  const openAgent = navigation?.openAgent;
57
59
  useRegisterOpenAgent(openAgent);
@@ -135,10 +137,10 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
135
137
 
136
138
  const tabs = useMemo(() => {
137
139
  const next: Array<{ id: TabId; label: string }> = [];
138
- if (skillItems.length > 0) next.push({ id: "skills", label: "Skills" });
139
- if (mcpItems.length > 0) next.push({ id: "mcp", label: "MCP" });
140
+ if (skillItems.length > 0) next.push({ id: "skills", label: m.common.skills });
141
+ if (mcpItems.length > 0) next.push({ id: "mcp", label: m.common.mcp });
140
142
  return next;
141
- }, [skillItems.length, mcpItems.length]);
143
+ }, [skillItems.length, mcpItems.length, m]);
142
144
 
143
145
  useEffect(() => {
144
146
  if (tabs.length === 0) {
@@ -154,26 +156,17 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
154
156
  () => ({
155
157
  screen: { flex: 1, backgroundColor: theme.colors.surface0 },
156
158
  content: {
157
- padding,
158
- paddingBottom: padding + 24,
159
- gap: layout.compact ? 20 : 28,
159
+ padding: page.padding,
160
+ paddingBottom: page.padding + 24,
161
+ gap: page.gap,
160
162
  maxWidth: 1000,
161
163
  width: "100%" as const,
162
164
  alignSelf: "center" as const,
163
165
  },
164
166
  sectionTitle: {
167
+ ...sectionTitle(layout.compact),
165
168
  color: theme.colors.foreground,
166
- fontSize: 14,
167
- fontWeight: "600" as const,
168
- flexShrink: 1,
169
- letterSpacing: -0.3,
170
- },
171
- listSectionTitle: {
172
- color: theme.colors.foreground,
173
- fontSize: 15,
174
- fontWeight: "600" as const,
175
169
  flexShrink: 1,
176
- letterSpacing: -0.3,
177
170
  },
178
171
  sectionHeaderRow: {
179
172
  flexDirection: "row" as const,
@@ -181,14 +174,7 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
181
174
  justifyContent: "space-between" as const,
182
175
  gap: 8,
183
176
  },
184
- titleAction: {
185
- width: 24,
186
- height: 24,
187
- alignItems: "center" as const,
188
- justifyContent: "center" as const,
189
- borderRadius: 6,
190
- flexShrink: 0,
191
- },
177
+ titleAction: iconButton,
192
178
  panel: {
193
179
  gap: 4,
194
180
  overflow: "hidden" as const,
@@ -198,7 +184,7 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
198
184
  alignItems: "center" as const,
199
185
  gap: 12,
200
186
  paddingHorizontal: 0,
201
- paddingVertical: 12,
187
+ paddingVertical: ROW_PADDING.regular,
202
188
  borderTopWidth: 0,
203
189
  borderTopColor: theme.colors.border,
204
190
  },
@@ -211,33 +197,30 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
211
197
  gap: 3,
212
198
  },
213
199
  listTitle: {
200
+ ...TEXT.rowTitle,
214
201
  color: theme.colors.foreground,
215
- fontSize: 14,
216
- fontWeight: "500" as const,
217
202
  },
218
203
  listLink: {
204
+ ...TEXT.rowTitle,
219
205
  color: theme.colors.foreground,
220
- fontSize: 14,
221
- fontWeight: "500" as const,
222
206
  },
223
207
  listMeta: {
208
+ ...TEXT.meta,
224
209
  color: theme.colors.foregroundMuted,
225
- fontSize: 12,
226
210
  },
227
211
  conversationLink: {
212
+ ...TEXT.meta,
228
213
  color: theme.colors.accent,
229
- fontSize: 12,
230
214
  },
231
215
  countText: {
216
+ ...TEXT.count,
232
217
  color: theme.colors.foregroundMuted,
233
- fontSize: 13,
234
- fontVariant: ["tabular-nums" as const],
235
218
  minWidth: 24,
236
219
  textAlign: "right" as const,
237
220
  },
238
221
  empty: {
222
+ ...TEXT.small,
239
223
  color: theme.colors.foregroundMuted,
240
- fontSize: 13,
241
224
  },
242
225
  backRow: {
243
226
  flexDirection: "row" as const,
@@ -246,21 +229,18 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
246
229
  alignSelf: "flex-start" as const,
247
230
  },
248
231
  back: {
232
+ ...TEXT.back,
249
233
  color: theme.colors.foregroundMuted,
250
- fontSize: 13,
251
- fontWeight: "500" as const,
252
234
  },
253
235
  body: {
236
+ ...TEXT.code,
254
237
  color: theme.colors.foreground,
255
- fontSize: 13,
256
- fontFamily: MONO,
257
- lineHeight: 22,
258
238
  backgroundColor: theme.colors.surface1,
259
239
  padding: 16,
260
- borderRadius: 12,
240
+ borderRadius: RADIUS.block,
261
241
  },
262
242
  }),
263
- [theme, layout.compact, padding],
243
+ [theme, layout.compact, page.padding, page.gap],
264
244
  );
265
245
 
266
246
  const loading = skillsByName.isLoading || mcpByTool.isLoading;
@@ -268,8 +248,8 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
268
248
  const showToggle = tabs.length > 1;
269
249
  const toggleAction =
270
250
  tab === "skills"
271
- ? { icon: "Plug" as const, accessibilityLabel: "Show MCP", next: "mcp" as const }
272
- : { icon: "Sparkles" as const, accessibilityLabel: "Show skills", next: "skills" as const };
251
+ ? { icon: "Plug" as const, accessibilityLabel: m.common.showMcp, next: "mcp" as const }
252
+ : { icon: "Sparkles" as const, accessibilityLabel: m.common.showSkills, next: "skills" as const };
273
253
 
274
254
  if (skillDetail) {
275
255
  return (
@@ -282,15 +262,13 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
282
262
  }}
283
263
  style={styles.backRow}
284
264
  >
285
- <Icon name="ChevronLeft" size={16} color={theme.colors.foregroundMuted} />
286
- <Text style={styles.back}>Skills</Text>
265
+ <Icon name="ChevronLeft" size={ICON_SIZE.action} color={theme.colors.foregroundMuted} />
266
+ <Text style={styles.back}>{m.common.skills}</Text>
287
267
  </Pressable>
288
268
  <Text style={styles.sectionTitle}>{formatDisplayName(skillDetail.skillName)}</Text>
289
- {skillFile.isLoading ? <ActivityIndicator color={theme.colors.accent} /> : null}
269
+ {skillFile.isLoading ? <LoadingState color={theme.colors.accent} /> : null}
290
270
  {skillFile.error ? (
291
- <Text style={{ color: theme.colors.statusDanger }}>
292
- {skillFile.error instanceof Error ? skillFile.error.message : String(skillFile.error)}
293
- </Text>
271
+ <ErrorState error={skillFile.error} onRetry={() => void skillFile.refetch()} colors={theme.colors} />
294
272
  ) : null}
295
273
  {skillFile.data ? (
296
274
  <Text style={styles.body} selectable>
@@ -307,7 +285,7 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
307
285
  {openAgent ? (
308
286
  <Text
309
287
  accessibilityRole="link"
310
- accessibilityLabel={`Open conversation ${conversationLabel}`}
288
+ accessibilityLabel={m.common.openConversation(conversationLabel)}
311
289
  style={styles.conversationLink}
312
290
  onPress={() => openAgent({ agentId })}
313
291
  >
@@ -318,46 +296,43 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
318
296
  )}
319
297
  </View>
320
298
  {!loading && !error ? <UsageStats compact={layout.compact} dense colors={theme.colors} items={[
321
- { label: "Skill calls", value: skillItems.reduce((sum, item) => sum + item.total, 0).toLocaleString() },
322
- { label: "MCP calls", value: mcpItems.reduce((sum, item) => sum + item.count, 0).toLocaleString() },
323
- { label: "Shell calls", value: (usageSummary.data?.shellCalls ?? 0).toLocaleString() },
324
- { label: "File reads", value: (usageSummary.data?.fileReads ?? 0).toLocaleString() },
325
- { label: "File writes", value: (usageSummary.data?.fileWrites ?? 0).toLocaleString() },
326
- { label: "Messages", value: (usageSummary.data?.messageCount ?? 0).toLocaleString() },
327
- { label: "Tools explored", value: String(skillItems.length + mcpItems.length) },
299
+ { label: m.kpi.skillCalls, value: skillItems.reduce((sum, item) => sum + item.total, 0).toLocaleString(locale) },
300
+ { label: m.kpi.mcpCalls, value: mcpItems.reduce((sum, item) => sum + item.count, 0).toLocaleString(locale) },
301
+ { label: m.kpi.shellCalls, value: (usageSummary.data?.shellCalls ?? 0).toLocaleString(locale) },
302
+ { label: m.kpi.fileReads, value: (usageSummary.data?.fileReads ?? 0).toLocaleString(locale) },
303
+ { label: m.kpi.fileWrites, value: (usageSummary.data?.fileWrites ?? 0).toLocaleString(locale) },
304
+ { label: m.kpi.prompts, value: (usageSummary.data?.messageCount ?? 0).toLocaleString(locale) },
305
+ { label: m.kpi.toolsExplored, value: String(skillItems.length + mcpItems.length) },
328
306
  ]} /> : null}
329
307
 
330
- {loading ? <ActivityIndicator color={theme.colors.accent} /> : null}
308
+ {loading ? <LoadingState color={theme.colors.accent} /> : null}
331
309
  {error ? (
332
- <Text style={{ color: theme.colors.statusDanger }}>
333
- {error instanceof Error ? error.message : String(error)}
334
- </Text>
310
+ <ErrorState
311
+ error={error}
312
+ onRetry={() => {
313
+ void skillsByName.refetch();
314
+ void mcpByTool.refetch();
315
+ }}
316
+ colors={theme.colors}
317
+ />
335
318
  ) : null}
336
319
 
337
320
  {!loading && !error && tabs.length === 0 ? (
338
- <Text style={styles.empty}>No skill or MCP calls yet</Text>
321
+ <InlineEmpty text={m.common.noSkillOrMcp} color={theme.colors.foregroundMuted} />
339
322
  ) : null}
340
323
 
341
324
  {tab ? (
342
- <View style={{ gap: 12 }}>
343
- <View style={styles.sectionHeaderRow}>
344
- <Text style={styles.listSectionTitle}>{tab === "skills" ? "Skills" : "MCP"}</Text>
325
+ <Section compact={layout.compact}>
326
+ <SectionHeader title={tab === "skills" ? m.common.skills : m.common.mcp} colors={theme.colors} compact={layout.compact}>
345
327
  {showToggle ? (
346
- <Pressable
347
- accessibilityRole="button"
348
- accessibilityLabel={toggleAction.accessibilityLabel}
349
- hitSlop={8}
328
+ <IconButton
329
+ icon={toggleAction.icon}
330
+ label={toggleAction.accessibilityLabel}
350
331
  onPress={() => setTab(toggleAction.next)}
351
- style={styles.titleAction}
352
- >
353
- <Icon
354
- name={toggleAction.icon}
355
- size={16}
356
- color={theme.colors.foregroundMuted}
357
- />
358
- </Pressable>
332
+ color={theme.colors.foregroundMuted}
333
+ />
359
334
  ) : null}
360
- </View>
335
+ </SectionHeader>
361
336
  {tab === "skills" ? (
362
337
  <View style={styles.panel}>
363
338
  {skillItems.map((item, index) => {
@@ -384,16 +359,16 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
384
359
  key={item.skillName}
385
360
  style={[styles.listRow, index === 0 ? styles.listRowFirst : null]}
386
361
  >
387
- <Icon name="Sparkles" size={18} color={theme.colors.foregroundMuted} />
362
+ <Icon name="Sparkles" size={ICON_SIZE.leading} color={theme.colors.foregroundMuted} />
388
363
  <View style={styles.listMain}>
389
364
  {title}
390
365
  <FormattedTime
391
366
  iso={item.lastUsedAt}
392
- prefix="Last "
367
+ format={m.common.lastUsed}
393
368
  style={styles.listMeta}
394
369
  />
395
370
  </View>
396
- <CountText value={item.total} styles={styles} />
371
+ <CountText value={item.total} color={theme.colors.foregroundMuted} />
397
372
  </View>
398
373
  );
399
374
  })}
@@ -405,29 +380,29 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
405
380
  key={`${item.server}.${item.tool}`}
406
381
  style={[styles.listRow, index === 0 ? styles.listRowFirst : null]}
407
382
  >
408
- <Icon name="Plug" size={18} color={theme.colors.foregroundMuted} />
383
+ <Icon name="Plug" size={ICON_SIZE.leading} color={theme.colors.foregroundMuted} />
409
384
  <View style={styles.listMain}>
410
385
  <Text style={styles.listTitle} numberOfLines={1}>
411
386
  {formatDisplayName(`${item.server}.${item.tool}`)}
412
387
  </Text>
413
388
  {item.failures > 0 ? (
414
- <Text style={styles.listMeta}>{item.failures} failed</Text>
389
+ <Text style={styles.listMeta}>{m.common.failed(item.failures)}</Text>
415
390
  ) : item.lastUsedAt ? (
416
391
  <FormattedTime
417
392
  iso={item.lastUsedAt}
418
- prefix="Last "
393
+ format={m.common.lastUsed}
419
394
  style={styles.listMeta}
420
395
  />
421
396
  ) : (
422
397
  <Text style={styles.listMeta}>—</Text>
423
398
  )}
424
399
  </View>
425
- <CountText value={item.count} styles={styles} />
400
+ <CountText value={item.count} color={theme.colors.foregroundMuted} />
426
401
  </View>
427
402
  ))}
428
403
  </View>
429
404
  )}
430
- </View>
405
+ </Section>
431
406
  ) : null}
432
407
  </ScrollView>
433
408
  );
@@ -0,0 +1,131 @@
1
+ import { Icon } from "@getpaseo/plugin/client/react-native";
2
+ import { useState, type ReactNode } from "react";
3
+ import { Platform, Pressable, ScrollView, Text, View } from "react-native";
4
+ import { CONTROL, FONT_WEIGHT, ICON_SIZE, RADIUS, TEXT } from "./design-tokens.ts";
5
+
6
+ const MENU_MIN_WIDTH = 200;
7
+ const MENU_ROW_HEIGHT = 28;
8
+ /** Rows visible before the menu scrolls. */
9
+ const MENU_VISIBLE_ROWS = 10;
10
+
11
+ type Colors = {
12
+ border: string;
13
+ foreground: string;
14
+ foregroundMuted: string;
15
+ surface1: string;
16
+ surface2: string;
17
+ };
18
+
19
+ /**
20
+ * `Provider: All ▾` filter (069). Lists every option; the menu floats under the
21
+ * right-aligned trigger (077) and a transparent backdrop closes it on outside
22
+ * press.
23
+ */
24
+ export function ProviderDropdown({
25
+ label,
26
+ options,
27
+ value,
28
+ onChange,
29
+ colors,
30
+ triggerLabel,
31
+ closeLabel,
32
+ }: {
33
+ label: string;
34
+ options: ReadonlyArray<{ id: string; label: string }>;
35
+ value: string;
36
+ onChange: (id: string) => void;
37
+ colors: Colors;
38
+ triggerLabel: string;
39
+ closeLabel: string;
40
+ }): ReactNode {
41
+ const [open, setOpen] = useState(false);
42
+ const current = options.find((option) => option.id === value) ?? options[0];
43
+
44
+ return (
45
+ <View style={{ position: "relative", zIndex: 20, alignSelf: "flex-start" }}>
46
+ <Pressable
47
+ accessibilityRole="button"
48
+ accessibilityLabel={triggerLabel}
49
+ accessibilityState={{ expanded: open }}
50
+ hitSlop={CONTROL.hitSlop}
51
+ onPress={() => setOpen((prev) => !prev)}
52
+ style={{ flexDirection: "row", alignItems: "center", gap: 4, paddingVertical: 6 }}
53
+ >
54
+ <Text style={{ ...TEXT.body, color: colors.foregroundMuted }}>{label}:</Text>
55
+ <Text style={{ ...TEXT.body, fontWeight: FONT_WEIGHT.semibold, color: colors.foreground }} numberOfLines={1}>
56
+ {current?.label ?? ""}
57
+ </Text>
58
+ <Icon name="ChevronDown" size={ICON_SIZE.inline} color={colors.foregroundMuted} />
59
+ </Pressable>
60
+
61
+ {open ? (
62
+ <>
63
+ <Pressable
64
+ accessibilityRole="button"
65
+ accessibilityLabel={closeLabel}
66
+ onPress={() => setOpen(false)}
67
+ style={{
68
+ position: (Platform.OS === "web" ? "fixed" : "absolute") as "absolute",
69
+ top: 0,
70
+ left: 0,
71
+ right: 0,
72
+ bottom: 0,
73
+ }}
74
+ />
75
+ <View
76
+ style={{
77
+ position: "absolute",
78
+ top: "100%",
79
+ right: 0,
80
+ marginTop: 4,
81
+ minWidth: MENU_MIN_WIDTH,
82
+ borderRadius: RADIUS.overlay,
83
+ borderWidth: 1,
84
+ borderColor: colors.border,
85
+ backgroundColor: colors.surface1,
86
+ shadowColor: "rgba(0, 0, 0, 0.04)",
87
+ shadowOffset: { width: 0, height: 4 },
88
+ shadowRadius: 16,
89
+ elevation: 4,
90
+ }}
91
+ >
92
+ <ScrollView
93
+ style={{ maxHeight: MENU_VISIBLE_ROWS * MENU_ROW_HEIGHT + 8 }}
94
+ contentContainerStyle={{ paddingVertical: 4 }}
95
+ >
96
+ {options.map((option) => {
97
+ const selected = option.id === value;
98
+ return (
99
+ <Pressable
100
+ key={option.id}
101
+ accessibilityRole="button"
102
+ accessibilityState={{ selected }}
103
+ onPress={() => {
104
+ onChange(option.id);
105
+ setOpen(false);
106
+ }}
107
+ style={({ pressed, hovered }: { pressed: boolean; hovered?: boolean }) => ({
108
+ flexDirection: "row",
109
+ alignItems: "center",
110
+ minHeight: MENU_ROW_HEIGHT,
111
+ gap: 8,
112
+ marginHorizontal: 4,
113
+ paddingHorizontal: 8,
114
+ borderRadius: RADIUS.control,
115
+ backgroundColor: pressed || hovered ? colors.surface2 : "transparent",
116
+ })}
117
+ >
118
+ <Text style={{ ...TEXT.menu, color: colors.foreground, flex: 1, minWidth: 0 }} numberOfLines={1}>
119
+ {option.label}
120
+ </Text>
121
+ {selected ? <Icon name="Check" size={ICON_SIZE.action} color={colors.foreground} /> : null}
122
+ </Pressable>
123
+ );
124
+ })}
125
+ </ScrollView>
126
+ </View>
127
+ </>
128
+ ) : null}
129
+ </View>
130
+ );
131
+ }
@@ -1,10 +1,8 @@
1
1
  import assert from "node:assert/strict";
2
2
  import { test } from "node:test";
3
- import {
4
- PROVIDER_FILTER_LIMIT,
5
- selectProviderOptions,
6
- type ProviderFilterCandidate,
7
- } from "./provider-filter.ts";
3
+ import { selectProviderOptions, type ProviderFilterCandidate } from "./provider-filter.ts";
4
+
5
+ const LIMIT = 5;
8
6
 
9
7
  function candidate(
10
8
  provider: string,
@@ -14,8 +12,14 @@ function candidate(
14
12
  return { provider, label: provider.toUpperCase(), agentCount, messageCount };
15
13
  }
16
14
 
17
- test("PROVIDER_FILTER_LIMIT is 5", () => {
18
- assert.equal(PROVIDER_FILTER_LIMIT, 5);
15
+ test("lists every provider by default (069)", () => {
16
+ const providers = ["a", "b", "c", "d", "e", "f", "g"].map((id, index) =>
17
+ candidate(id, 7 - index, 0),
18
+ );
19
+ assert.deepEqual(
20
+ selectProviderOptions(providers, "all").map((item) => item.id),
21
+ ["a", "b", "c", "d", "e", "f", "g"],
22
+ );
19
23
  });
20
24
 
21
25
  test("ranks by agent count, then message count", () => {
@@ -40,12 +44,12 @@ test("breaks ties by provider id", () => {
40
44
  );
41
45
  });
42
46
 
43
- test("caps the list at the limit", () => {
47
+ test("caps the list at an explicit limit", () => {
44
48
  const providers = ["a", "b", "c", "d", "e", "f", "g"].map((id, index) =>
45
49
  candidate(id, 7 - index, 0),
46
50
  );
47
- const options = selectProviderOptions(providers, "all");
48
- assert.equal(options.length, PROVIDER_FILTER_LIMIT);
51
+ const options = selectProviderOptions(providers, "all", LIMIT);
52
+ assert.equal(options.length, LIMIT);
49
53
  assert.deepEqual(
50
54
  options.map((item) => item.id),
51
55
  ["a", "b", "c", "d", "e"],
@@ -56,8 +60,8 @@ test("keeps a selected provider that fell out of the top list", () => {
56
60
  const providers = ["a", "b", "c", "d", "e", "f"].map((id, index) =>
57
61
  candidate(id, 6 - index, 0),
58
62
  );
59
- const options = selectProviderOptions(providers, "f");
60
- assert.equal(options.length, PROVIDER_FILTER_LIMIT);
63
+ const options = selectProviderOptions(providers, "f", LIMIT);
64
+ assert.equal(options.length, LIMIT);
61
65
  assert.deepEqual(
62
66
  options.map((item) => item.id),
63
67
  ["a", "b", "c", "d", "f"],
@@ -68,7 +72,7 @@ test("keeps order when the selected provider is already in the top list", () =>
68
72
  const providers = ["a", "b", "c", "d", "e", "f"].map((id, index) =>
69
73
  candidate(id, 6 - index, 0),
70
74
  );
71
- const options = selectProviderOptions(providers, "b");
75
+ const options = selectProviderOptions(providers, "b", LIMIT);
72
76
  assert.deepEqual(
73
77
  options.map((item) => item.id),
74
78
  ["a", "b", "c", "d", "e"],
@@ -1,6 +1,3 @@
1
- /** Max provider chips shown in the global Activity filter bar (excludes All). */
2
- export const PROVIDER_FILTER_LIMIT = 5;
3
-
4
1
  export type ProviderFilterCandidate = {
5
2
  provider: string;
6
3
  label: string;
@@ -9,14 +6,15 @@ export type ProviderFilterCandidate = {
9
6
  };
10
7
 
11
8
  /**
12
- * Rank provider chips for the global filter bar: most agents first, then most
13
- * messages, then provider id. Caps the list at `limit`; a selected provider that
14
- * fell out of the top `limit` replaces the last entry so the filter stays visible.
9
+ * Rank provider options for the global filter dropdown: most sessions first,
10
+ * then most messages, then provider id. Uncapped by default (069); with a
11
+ * `limit`, a selected provider that fell out of the top `limit` replaces the
12
+ * last entry so the filter stays visible.
15
13
  */
16
14
  export function selectProviderOptions(
17
15
  providers: ReadonlyArray<ProviderFilterCandidate>,
18
16
  selected: string,
19
- limit = PROVIDER_FILTER_LIMIT,
17
+ limit = Number.POSITIVE_INFINITY,
20
18
  ): Array<{ id: string; label: string }> {
21
19
  const capped = Math.max(0, limit);
22
20
  const ranked = [...providers].sort(
@@ -1,4 +1,4 @@
1
- import { brandProviderId, normalizeProvider } from "../shared/classify.ts";
1
+ import { normalizeProvider } from "../shared/classify.ts";
2
2
 
3
3
  export type ChartColorScheme = "light" | "dark";
4
4
 
@@ -45,7 +45,7 @@ const CHART_PALETTE: Record<ChartColorScheme, readonly string[]> = {
45
45
  * Known Paseo provider ids (builtin + ACP catalog + normalize aliases).
46
46
  * Sources: `packages/protocol/src/provider-manifest.ts` builtins,
47
47
  * `packages/app/src/data/acp-provider-catalog.ts`, and `normalizeProvider`
48
- * aliases (`codebuddy-code` → `codebuddy`, `omp` → `pi`).
48
+ * aliases (`codebuddy-code` → `codebuddy`).
49
49
  */
50
50
  const KNOWN_PROVIDER_IDS = [
51
51
  "agoragentic-acp",
@@ -250,7 +250,7 @@ export function providerColor(provider: string, scheme: ChartColorScheme): strin
250
250
 
251
251
  /** Brand fill for a known provider, or `null` when it falls back to the soft palette. */
252
252
  export function brandColor(provider: string, scheme: ChartColorScheme): string | null {
253
- return PROVIDER_BRAND[brandProviderId(provider)]?.[scheme] ?? null;
253
+ return PROVIDER_BRAND[normalizeProvider(provider)]?.[scheme] ?? null;
254
254
  }
255
255
 
256
256
  /**