@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
package/client/panel.tsx CHANGED
@@ -1,17 +1,9 @@
1
1
  import { type PluginAgentPanelProps, useAgent, useRpc } from "@getpaseo/plugin/client";
2
- import { Icon } from "@getpaseo/plugin/client/react-native";
2
+ import { Icon } from "@getpaseo/plugin/client/ui";
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,26 @@ 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
+ PRESS,
36
+ RADIUS,
37
+ ROW_PADDING,
38
+ TEXT,
39
+ iconButton,
40
+ pageLayout,
41
+ sectionTitle,
42
+ } from "./design-tokens.ts";
31
43
 
32
44
  type TabId = "skills" | "mcp";
33
45
 
@@ -36,22 +48,14 @@ type SkillDetail = {
36
48
  path: string;
37
49
  };
38
50
 
39
- const MONO = Platform.select({ ios: "Menlo", default: "monospace" });
40
51
 
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
-
51
- export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPanelProps) {
52
+ export function UsagePanel({ theme, layout, params, navigation }: PluginAgentPanelProps) {
53
+ const { agentId } = params;
54
+ const locale = useAppLanguage();
55
+ const m = useMessages();
52
56
  const [tab, setTab] = useState<TabId | null>(null);
53
57
  const [skillDetail, setSkillDetail] = useState<SkillDetail | null>(null);
54
- const padding = layout.compact ? 16 : 28;
58
+ const page = pageLayout("panel", layout.compact);
55
59
  const agentTitle = useAgent(agentId, (agent) => agent.title);
56
60
  const openAgent = navigation?.openAgent;
57
61
  useRegisterOpenAgent(openAgent);
@@ -135,10 +139,10 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
135
139
 
136
140
  const tabs = useMemo(() => {
137
141
  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" });
142
+ if (skillItems.length > 0) next.push({ id: "skills", label: m.common.skills });
143
+ if (mcpItems.length > 0) next.push({ id: "mcp", label: m.common.mcp });
140
144
  return next;
141
- }, [skillItems.length, mcpItems.length]);
145
+ }, [skillItems.length, mcpItems.length, m]);
142
146
 
143
147
  useEffect(() => {
144
148
  if (tabs.length === 0) {
@@ -154,26 +158,17 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
154
158
  () => ({
155
159
  screen: { flex: 1, backgroundColor: theme.colors.surface0 },
156
160
  content: {
157
- padding,
158
- paddingBottom: padding + 24,
159
- gap: layout.compact ? 20 : 28,
161
+ padding: page.padding,
162
+ paddingBottom: page.padding + 24,
163
+ gap: page.gap,
160
164
  maxWidth: 1000,
161
165
  width: "100%" as const,
162
166
  alignSelf: "center" as const,
163
167
  },
164
168
  sectionTitle: {
169
+ ...sectionTitle(layout.compact),
165
170
  color: theme.colors.foreground,
166
- fontSize: 14,
167
- fontWeight: "600" as const,
168
171
  flexShrink: 1,
169
- letterSpacing: -0.3,
170
- },
171
- listSectionTitle: {
172
- color: theme.colors.foreground,
173
- fontSize: 15,
174
- fontWeight: "600" as const,
175
- flexShrink: 1,
176
- letterSpacing: -0.3,
177
172
  },
178
173
  sectionHeaderRow: {
179
174
  flexDirection: "row" as const,
@@ -181,14 +176,7 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
181
176
  justifyContent: "space-between" as const,
182
177
  gap: 8,
183
178
  },
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
- },
179
+ titleAction: iconButton,
192
180
  panel: {
193
181
  gap: 4,
194
182
  overflow: "hidden" as const,
@@ -198,7 +186,7 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
198
186
  alignItems: "center" as const,
199
187
  gap: 12,
200
188
  paddingHorizontal: 0,
201
- paddingVertical: 12,
189
+ paddingVertical: ROW_PADDING.regular,
202
190
  borderTopWidth: 0,
203
191
  borderTopColor: theme.colors.border,
204
192
  },
@@ -211,33 +199,30 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
211
199
  gap: 3,
212
200
  },
213
201
  listTitle: {
202
+ ...TEXT.rowTitle,
214
203
  color: theme.colors.foreground,
215
- fontSize: 14,
216
- fontWeight: "500" as const,
217
204
  },
218
205
  listLink: {
206
+ ...TEXT.rowTitle,
219
207
  color: theme.colors.foreground,
220
- fontSize: 14,
221
- fontWeight: "500" as const,
222
208
  },
223
209
  listMeta: {
210
+ ...TEXT.meta,
224
211
  color: theme.colors.foregroundMuted,
225
- fontSize: 12,
226
212
  },
227
213
  conversationLink: {
214
+ ...TEXT.meta,
228
215
  color: theme.colors.accent,
229
- fontSize: 12,
230
216
  },
231
217
  countText: {
218
+ ...TEXT.count,
232
219
  color: theme.colors.foregroundMuted,
233
- fontSize: 13,
234
- fontVariant: ["tabular-nums" as const],
235
220
  minWidth: 24,
236
221
  textAlign: "right" as const,
237
222
  },
238
223
  empty: {
224
+ ...TEXT.small,
239
225
  color: theme.colors.foregroundMuted,
240
- fontSize: 13,
241
226
  },
242
227
  backRow: {
243
228
  flexDirection: "row" as const,
@@ -246,21 +231,18 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
246
231
  alignSelf: "flex-start" as const,
247
232
  },
248
233
  back: {
234
+ ...TEXT.back,
249
235
  color: theme.colors.foregroundMuted,
250
- fontSize: 13,
251
- fontWeight: "500" as const,
252
236
  },
253
237
  body: {
238
+ ...TEXT.code,
254
239
  color: theme.colors.foreground,
255
- fontSize: 13,
256
- fontFamily: MONO,
257
- lineHeight: 22,
258
240
  backgroundColor: theme.colors.surface1,
259
241
  padding: 16,
260
- borderRadius: 12,
242
+ borderRadius: RADIUS.block,
261
243
  },
262
244
  }),
263
- [theme, layout.compact, padding],
245
+ [theme, layout.compact, page.padding, page.gap],
264
246
  );
265
247
 
266
248
  const loading = skillsByName.isLoading || mcpByTool.isLoading;
@@ -268,8 +250,8 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
268
250
  const showToggle = tabs.length > 1;
269
251
  const toggleAction =
270
252
  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 };
253
+ ? { icon: "Plug" as const, accessibilityLabel: m.common.showMcp, next: "mcp" as const }
254
+ : { icon: "Sparkles" as const, accessibilityLabel: m.common.showSkills, next: "skills" as const };
273
255
 
274
256
  if (skillDetail) {
275
257
  return (
@@ -280,17 +262,18 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
280
262
  clearPendingSkillOpen(agentId);
281
263
  setSkillDetail(null);
282
264
  }}
283
- style={styles.backRow}
265
+ style={({ pressed }) => [
266
+ styles.backRow,
267
+ pressed ? { opacity: PRESS.textOpacity } : null,
268
+ ]}
284
269
  >
285
- <Icon name="ChevronLeft" size={16} color={theme.colors.foregroundMuted} />
286
- <Text style={styles.back}>Skills</Text>
270
+ <Icon name="ChevronLeft" size={ICON_SIZE.action} color={theme.colors.foregroundMuted} />
271
+ <Text style={styles.back}>{m.common.skills}</Text>
287
272
  </Pressable>
288
273
  <Text style={styles.sectionTitle}>{formatDisplayName(skillDetail.skillName)}</Text>
289
- {skillFile.isLoading ? <ActivityIndicator color={theme.colors.accent} /> : null}
274
+ {skillFile.isLoading ? <LoadingState color={theme.colors.accent} /> : null}
290
275
  {skillFile.error ? (
291
- <Text style={{ color: theme.colors.statusDanger }}>
292
- {skillFile.error instanceof Error ? skillFile.error.message : String(skillFile.error)}
293
- </Text>
276
+ <ErrorState error={skillFile.error} onRetry={() => void skillFile.refetch()} colors={theme.colors} />
294
277
  ) : null}
295
278
  {skillFile.data ? (
296
279
  <Text style={styles.body} selectable>
@@ -307,7 +290,7 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
307
290
  {openAgent ? (
308
291
  <Text
309
292
  accessibilityRole="link"
310
- accessibilityLabel={`Open conversation ${conversationLabel}`}
293
+ accessibilityLabel={m.common.openConversation(conversationLabel)}
311
294
  style={styles.conversationLink}
312
295
  onPress={() => openAgent({ agentId })}
313
296
  >
@@ -318,46 +301,43 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
318
301
  )}
319
302
  </View>
320
303
  {!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) },
304
+ { label: m.kpi.skillCalls, value: skillItems.reduce((sum, item) => sum + item.total, 0).toLocaleString(locale) },
305
+ { label: m.kpi.mcpCalls, value: mcpItems.reduce((sum, item) => sum + item.count, 0).toLocaleString(locale) },
306
+ { label: m.kpi.shellCalls, value: (usageSummary.data?.shellCalls ?? 0).toLocaleString(locale) },
307
+ { label: m.kpi.fileReads, value: (usageSummary.data?.fileReads ?? 0).toLocaleString(locale) },
308
+ { label: m.kpi.fileWrites, value: (usageSummary.data?.fileWrites ?? 0).toLocaleString(locale) },
309
+ { label: m.kpi.prompts, value: (usageSummary.data?.messageCount ?? 0).toLocaleString(locale) },
310
+ { label: m.kpi.toolsExplored, value: String(skillItems.length + mcpItems.length) },
328
311
  ]} /> : null}
329
312
 
330
- {loading ? <ActivityIndicator color={theme.colors.accent} /> : null}
313
+ {loading ? <LoadingState color={theme.colors.accent} /> : null}
331
314
  {error ? (
332
- <Text style={{ color: theme.colors.statusDanger }}>
333
- {error instanceof Error ? error.message : String(error)}
334
- </Text>
315
+ <ErrorState
316
+ error={error}
317
+ onRetry={() => {
318
+ void skillsByName.refetch();
319
+ void mcpByTool.refetch();
320
+ }}
321
+ colors={theme.colors}
322
+ />
335
323
  ) : null}
336
324
 
337
325
  {!loading && !error && tabs.length === 0 ? (
338
- <Text style={styles.empty}>No skill or MCP calls yet</Text>
326
+ <InlineEmpty text={m.common.noSkillOrMcp} color={theme.colors.foregroundMuted} />
339
327
  ) : null}
340
328
 
341
329
  {tab ? (
342
- <View style={{ gap: 12 }}>
343
- <View style={styles.sectionHeaderRow}>
344
- <Text style={styles.listSectionTitle}>{tab === "skills" ? "Skills" : "MCP"}</Text>
330
+ <Section compact={layout.compact}>
331
+ <SectionHeader title={tab === "skills" ? m.common.skills : m.common.mcp} colors={theme.colors} compact={layout.compact}>
345
332
  {showToggle ? (
346
- <Pressable
347
- accessibilityRole="button"
348
- accessibilityLabel={toggleAction.accessibilityLabel}
349
- hitSlop={8}
333
+ <IconButton
334
+ icon={toggleAction.icon}
335
+ label={toggleAction.accessibilityLabel}
350
336
  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>
337
+ color={theme.colors.foregroundMuted}
338
+ />
359
339
  ) : null}
360
- </View>
340
+ </SectionHeader>
361
341
  {tab === "skills" ? (
362
342
  <View style={styles.panel}>
363
343
  {skillItems.map((item, index) => {
@@ -369,6 +349,9 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
369
349
  onPress={() =>
370
350
  setSkillDetail({ skillName: item.skillName, path: item.skillPath! })
371
351
  }
352
+ style={({ pressed }) =>
353
+ pressed ? { opacity: PRESS.textOpacity } : undefined
354
+ }
372
355
  >
373
356
  <Text style={styles.listLink} numberOfLines={1}>
374
357
  {name}
@@ -384,16 +367,16 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
384
367
  key={item.skillName}
385
368
  style={[styles.listRow, index === 0 ? styles.listRowFirst : null]}
386
369
  >
387
- <Icon name="Sparkles" size={18} color={theme.colors.foregroundMuted} />
370
+ <Icon name="Sparkles" size={ICON_SIZE.leading} color={theme.colors.foregroundMuted} />
388
371
  <View style={styles.listMain}>
389
372
  {title}
390
373
  <FormattedTime
391
374
  iso={item.lastUsedAt}
392
- prefix="Last "
375
+ format={m.common.lastUsed}
393
376
  style={styles.listMeta}
394
377
  />
395
378
  </View>
396
- <CountText value={item.total} styles={styles} />
379
+ <CountText value={item.total} color={theme.colors.foregroundMuted} />
397
380
  </View>
398
381
  );
399
382
  })}
@@ -405,29 +388,29 @@ export function UsagePanel({ theme, layout, agentId, navigation }: PluginAgentPa
405
388
  key={`${item.server}.${item.tool}`}
406
389
  style={[styles.listRow, index === 0 ? styles.listRowFirst : null]}
407
390
  >
408
- <Icon name="Plug" size={18} color={theme.colors.foregroundMuted} />
391
+ <Icon name="Plug" size={ICON_SIZE.leading} color={theme.colors.foregroundMuted} />
409
392
  <View style={styles.listMain}>
410
393
  <Text style={styles.listTitle} numberOfLines={1}>
411
394
  {formatDisplayName(`${item.server}.${item.tool}`)}
412
395
  </Text>
413
396
  {item.failures > 0 ? (
414
- <Text style={styles.listMeta}>{item.failures} failed</Text>
397
+ <Text style={styles.listMeta}>{m.common.failed(item.failures)}</Text>
415
398
  ) : item.lastUsedAt ? (
416
399
  <FormattedTime
417
400
  iso={item.lastUsedAt}
418
- prefix="Last "
401
+ format={m.common.lastUsed}
419
402
  style={styles.listMeta}
420
403
  />
421
404
  ) : (
422
405
  <Text style={styles.listMeta}>—</Text>
423
406
  )}
424
407
  </View>
425
- <CountText value={item.count} styles={styles} />
408
+ <CountText value={item.count} color={theme.colors.foregroundMuted} />
426
409
  </View>
427
410
  ))}
428
411
  </View>
429
412
  )}
430
- </View>
413
+ </Section>
431
414
  ) : null}
432
415
  </ScrollView>
433
416
  );
package/client/pill.tsx CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  type PluginButtonRegistration,
8
8
  type PluginClientContext,
9
9
  } from "@getpaseo/plugin/client";
10
- import { Icon } from "@getpaseo/plugin/client/react-native";
10
+ import { Icon } from "@getpaseo/plugin/client/ui";
11
11
  import { useEffect, useRef } from "react";
12
12
  import { formatUsagePillLabel, usageSkillsByNameRpc, usageMcpByToolRpc } from "../shared/usage.ts";
13
13
  import { useUsagePillData, clearPillDataCache } from "./usage-query.tsx";
@@ -0,0 +1,134 @@
1
+ import { Icon } from "@getpaseo/plugin/client/ui";
2
+ import { useState, type ReactNode } from "react";
3
+ import { Platform, Pressable, ScrollView, Text, View } from "react-native";
4
+ import { CONTROL, FONT_WEIGHT, ICON_SIZE, PRESS, 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={({ pressed }) => [
53
+ { flexDirection: "row", alignItems: "center", gap: 4, paddingVertical: 6 },
54
+ pressed ? { opacity: PRESS.textOpacity } : null,
55
+ ]}
56
+ >
57
+ <Text style={{ ...TEXT.body, color: colors.foregroundMuted }}>{label}:</Text>
58
+ <Text style={{ ...TEXT.body, fontWeight: FONT_WEIGHT.semibold, color: colors.foreground }} numberOfLines={1}>
59
+ {current?.label ?? ""}
60
+ </Text>
61
+ <Icon name="ChevronDown" size={ICON_SIZE.inline} color={colors.foregroundMuted} />
62
+ </Pressable>
63
+
64
+ {open ? (
65
+ <>
66
+ <Pressable
67
+ accessibilityRole="button"
68
+ accessibilityLabel={closeLabel}
69
+ onPress={() => setOpen(false)}
70
+ style={{
71
+ position: (Platform.OS === "web" ? "fixed" : "absolute") as "absolute",
72
+ top: 0,
73
+ left: 0,
74
+ right: 0,
75
+ bottom: 0,
76
+ }}
77
+ />
78
+ <View
79
+ style={{
80
+ position: "absolute",
81
+ top: "100%",
82
+ right: 0,
83
+ marginTop: 4,
84
+ minWidth: MENU_MIN_WIDTH,
85
+ borderRadius: RADIUS.overlay,
86
+ borderWidth: 1,
87
+ borderColor: colors.border,
88
+ backgroundColor: colors.surface1,
89
+ shadowColor: "rgba(0, 0, 0, 0.04)",
90
+ shadowOffset: { width: 0, height: 4 },
91
+ shadowRadius: 16,
92
+ elevation: 4,
93
+ }}
94
+ >
95
+ <ScrollView
96
+ style={{ maxHeight: MENU_VISIBLE_ROWS * MENU_ROW_HEIGHT + 8 }}
97
+ contentContainerStyle={{ paddingVertical: 4 }}
98
+ >
99
+ {options.map((option) => {
100
+ const selected = option.id === value;
101
+ return (
102
+ <Pressable
103
+ key={option.id}
104
+ accessibilityRole="button"
105
+ accessibilityState={{ selected }}
106
+ onPress={() => {
107
+ onChange(option.id);
108
+ setOpen(false);
109
+ }}
110
+ style={({ pressed, hovered }: { pressed: boolean; hovered?: boolean }) => ({
111
+ flexDirection: "row",
112
+ alignItems: "center",
113
+ minHeight: MENU_ROW_HEIGHT,
114
+ gap: 8,
115
+ marginHorizontal: 4,
116
+ paddingHorizontal: 8,
117
+ borderRadius: RADIUS.control,
118
+ backgroundColor: pressed || hovered ? colors.surface2 : "transparent",
119
+ })}
120
+ >
121
+ <Text style={{ ...TEXT.menu, color: colors.foreground, flex: 1, minWidth: 0 }} numberOfLines={1}>
122
+ {option.label}
123
+ </Text>
124
+ {selected ? <Icon name="Check" size={ICON_SIZE.action} color={colors.foreground} /> : null}
125
+ </Pressable>
126
+ );
127
+ })}
128
+ </ScrollView>
129
+ </View>
130
+ </>
131
+ ) : null}
132
+ </View>
133
+ );
134
+ }
@@ -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
  /**