@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.
- package/CHANGELOG.md +50 -1
- package/README.md +18 -11
- package/client/activity-heatmap.tsx +115 -74
- package/client/agent-creations.tsx +100 -90
- package/client/attention-pill.tsx +17 -6
- package/client/attention-popover.tsx +19 -23
- package/client/design-tokens.test.ts +39 -0
- package/client/design-tokens.ts +180 -0
- package/client/formatted-time.tsx +4 -4
- package/client/global-surface.tsx +243 -268
- package/client/header-button.ts +136 -0
- package/client/hourly-activity-timeline.tsx +153 -103
- package/client/panel-visibility.test.ts +25 -0
- package/client/panel-visibility.ts +45 -0
- package/client/panel.tsx +94 -111
- package/client/pill.tsx +1 -1
- package/client/provider-dropdown.tsx +134 -0
- package/client/provider-filter.test.ts +17 -13
- package/client/provider-filter.ts +5 -7
- package/client/rank-color.ts +3 -3
- package/client/ranking-bars.tsx +294 -0
- package/client/sidebar-item.tsx +15 -0
- package/client/ui.tsx +351 -0
- package/client/usage-popover.tsx +72 -137
- package/client/usage-stats.tsx +29 -11
- package/client/use-agent-turn-end.ts +2 -1
- package/client/use-app-language.ts +17 -0
- package/client/web.ts +73 -18
- package/client/workspace/agent-row.tsx +28 -28
- package/client/workspace/agents-section.tsx +42 -57
- package/client/workspace/constants.ts +8 -6
- package/client/workspace/display-menu.tsx +6 -5
- package/client/workspace/filters.test.ts +1 -1
- package/client/workspace/filters.ts +4 -2
- package/client/workspace/panel.tsx +96 -104
- package/client/workspace/rank-section.tsx +40 -65
- package/client/workspace/running-indicator.tsx +1 -1
- package/client/workspace/terminals-section.tsx +24 -12
- package/index.client.tsx +53 -31
- package/index.server.ts +55 -73
- package/package.json +3 -3
- package/paseo-plugin.json +2 -1
- package/server/agents.ts +20 -2
- package/server/background-sync.ts +34 -4
- package/server/handlers-query.test.ts +27 -1
- package/server/handlers.ts +75 -31
- package/server/host-types.ts +6 -6
- package/server/ingest.test.ts +8 -0
- package/server/messages.test.ts +96 -1
- package/server/prompt-dedupe.ts +52 -0
- package/server/rpc-cache.test.ts +74 -0
- package/server/rpc-cache.ts +48 -0
- package/server/store.test.ts +122 -0
- package/server/store.ts +313 -19
- package/server/ttl-cache.ts +3 -0
- package/server/turn-ingest.test.ts +180 -0
- package/server/turn-ingest.ts +71 -0
- package/shared/activity.test.ts +36 -0
- package/shared/activity.ts +37 -0
- package/shared/classify.test.ts +1 -10
- package/shared/classify.ts +3 -10
- package/shared/format.ts +10 -7
- package/shared/i18n.test.ts +34 -0
- package/shared/i18n.ts +363 -0
- package/shared/insights.test.ts +120 -81
- package/shared/insights.ts +125 -64
- package/shared/usage.test.ts +121 -0
- package/shared/usage.ts +191 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Icon } from "@getpaseo/plugin/client/
|
|
1
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
2
2
|
import { useState, type ReactNode } from "react";
|
|
3
3
|
import {
|
|
4
4
|
ActivityIndicator,
|
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
} from "react-native";
|
|
12
12
|
import type { AgentAttentionKind, WorkspaceTheme } from "./constants.ts";
|
|
13
13
|
import { RunningIndicator } from "./running-indicator.tsx";
|
|
14
|
+
import { CONTROL, ICON_SIZE, PRESS } from "../design-tokens.ts";
|
|
15
|
+
import { useMessages } from "../use-app-language.ts";
|
|
14
16
|
|
|
15
17
|
export type AgentRowStyles = {
|
|
16
18
|
agentListRow: ViewStyle;
|
|
@@ -60,6 +62,7 @@ export function AgentRow({
|
|
|
60
62
|
/** Omit to hide the archive control (attention popover). */
|
|
61
63
|
onArchiveToggle?: () => void;
|
|
62
64
|
}): ReactNode {
|
|
65
|
+
const m = useMessages();
|
|
63
66
|
const [hovered, setHovered] = useState(false);
|
|
64
67
|
// Web: hover-reveal. Native has no hover — keep the action visible.
|
|
65
68
|
// mouseenter/leave (not nested Pressable hover) so title/action don't flicker.
|
|
@@ -81,17 +84,11 @@ export function AgentRow({
|
|
|
81
84
|
? theme.colors.statusSuccess
|
|
82
85
|
: theme.colors.foregroundMuted;
|
|
83
86
|
const stateLabels: string[] = [];
|
|
84
|
-
if (!archived && running) stateLabels.push(
|
|
85
|
-
if (subAgentCount > 0)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (
|
|
89
|
-
stateLabels.push(
|
|
90
|
-
permissionCount === 1 ? "1 pending permission" : `${permissionCount} pending permissions`,
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
if (!archived && attentionKind === "error") stateLabels.push("failed");
|
|
94
|
-
if (!archived && attentionKind === "finished") stateLabels.push("turn finished, unread");
|
|
87
|
+
if (!archived && running) stateLabels.push(m.workspace.state.running);
|
|
88
|
+
if (subAgentCount > 0) stateLabels.push(m.workspace.state.subagents(subAgentCount));
|
|
89
|
+
if (permissionCount > 0) stateLabels.push(m.workspace.state.permissions(permissionCount));
|
|
90
|
+
if (!archived && attentionKind === "error") stateLabels.push(m.workspace.state.failed);
|
|
91
|
+
if (!archived && attentionKind === "finished") stateLabels.push(m.workspace.state.finished);
|
|
95
92
|
const stateSuffix = stateLabels.length > 0 ? `, ${stateLabels.join(", ")}` : "";
|
|
96
93
|
const showRunning = running && !archived;
|
|
97
94
|
const showSubAgentCount = !showRunning && subAgentCount > 0;
|
|
@@ -102,7 +99,7 @@ export function AgentRow({
|
|
|
102
99
|
<View style={styles.agentIconWrap}>
|
|
103
100
|
<Icon
|
|
104
101
|
name={archived ? "BotOff" : "Bot"}
|
|
105
|
-
size={
|
|
102
|
+
size={ICON_SIZE.leading}
|
|
106
103
|
color={botColor}
|
|
107
104
|
/>
|
|
108
105
|
{showRunning ? (
|
|
@@ -111,9 +108,7 @@ export function AgentRow({
|
|
|
111
108
|
</View>
|
|
112
109
|
) : showSubAgentCount ? (
|
|
113
110
|
<View
|
|
114
|
-
accessibilityLabel={
|
|
115
|
-
subAgentCount === 1 ? "1 subagent" : `${subAgentCount} subagents`
|
|
116
|
-
}
|
|
111
|
+
accessibilityLabel={m.workspace.state.subagents(subAgentCount)}
|
|
117
112
|
style={styles.subAgentBadge}
|
|
118
113
|
>
|
|
119
114
|
<Text style={styles.subAgentBadgeText}>{subAgentLabel}</Text>
|
|
@@ -132,12 +127,10 @@ export function AgentRow({
|
|
|
132
127
|
</View>
|
|
133
128
|
{permissionCount > 0 ? (
|
|
134
129
|
<View
|
|
135
|
-
accessibilityLabel={
|
|
136
|
-
permissionCount === 1 ? "1 pending permission" : `${permissionCount} pending permissions`
|
|
137
|
-
}
|
|
130
|
+
accessibilityLabel={m.workspace.state.permissions(permissionCount)}
|
|
138
131
|
style={styles.permissionBadge}
|
|
139
132
|
>
|
|
140
|
-
<Icon name="ShieldAlert" size={
|
|
133
|
+
<Icon name="ShieldAlert" size={ICON_SIZE.badge} color={theme.colors.statusWarning} />
|
|
141
134
|
{permissionCount > 1 ? (
|
|
142
135
|
<Text style={styles.permissionBadgeText}>{permissionCount}</Text>
|
|
143
136
|
) : null}
|
|
@@ -146,24 +139,28 @@ export function AgentRow({
|
|
|
146
139
|
{onArchiveToggle ? (
|
|
147
140
|
<Pressable
|
|
148
141
|
accessibilityRole="button"
|
|
149
|
-
accessibilityLabel={archived ?
|
|
142
|
+
accessibilityLabel={archived ? m.workspace.unarchive(label) : m.workspace.archive(label)}
|
|
150
143
|
accessibilityState={{ disabled: actionDisabled }}
|
|
151
144
|
disabled={actionDisabled || !showAction}
|
|
152
|
-
hitSlop={
|
|
145
|
+
hitSlop={CONTROL.hitSlop}
|
|
153
146
|
onPress={onArchiveToggle}
|
|
154
147
|
pointerEvents={showAction ? "auto" : "none"}
|
|
155
|
-
style={
|
|
148
|
+
style={({ pressed }) => [
|
|
149
|
+
styles.titleAction,
|
|
150
|
+
{ opacity: showAction ? 1 : 0 },
|
|
151
|
+
pressed ? { opacity: PRESS.opacity, transform: [{ scale: PRESS.scale }] } : null,
|
|
152
|
+
]}
|
|
156
153
|
>
|
|
157
154
|
{busy ? (
|
|
158
155
|
<ActivityIndicator
|
|
159
|
-
size={
|
|
156
|
+
size={ICON_SIZE.inline}
|
|
160
157
|
color={theme.colors.foregroundMuted}
|
|
161
|
-
style={{ width:
|
|
158
|
+
style={{ width: ICON_SIZE.inline, height: ICON_SIZE.inline }}
|
|
162
159
|
/>
|
|
163
160
|
) : (
|
|
164
161
|
<Icon
|
|
165
162
|
name={archived ? "ArchiveRestore" : "Archive"}
|
|
166
|
-
size={
|
|
163
|
+
size={ICON_SIZE.inline}
|
|
167
164
|
color={theme.colors.foregroundMuted}
|
|
168
165
|
/>
|
|
169
166
|
)}
|
|
@@ -176,9 +173,12 @@ export function AgentRow({
|
|
|
176
173
|
return (
|
|
177
174
|
<Pressable
|
|
178
175
|
accessibilityRole="link"
|
|
179
|
-
accessibilityLabel={
|
|
176
|
+
accessibilityLabel={`${m.common.openConversation(label)}${stateSuffix}`}
|
|
180
177
|
onPress={onOpen}
|
|
181
|
-
style={
|
|
178
|
+
style={({ pressed }) => [
|
|
179
|
+
styles.agentListRow,
|
|
180
|
+
pressed ? { backgroundColor: theme.colors.surface2 } : null,
|
|
181
|
+
]}
|
|
182
182
|
{...hoverProps}
|
|
183
183
|
>
|
|
184
184
|
{body}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Icon, TextInput } from "@getpaseo/plugin/client/
|
|
1
|
+
import { Icon, TextInput } from "@getpaseo/plugin/client/ui";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState, type ReactNode, type RefObject } from "react";
|
|
3
3
|
import {
|
|
4
4
|
Animated,
|
|
5
5
|
Easing,
|
|
6
|
-
Pressable,
|
|
7
6
|
Text,
|
|
8
7
|
View,
|
|
9
8
|
type TextStyle,
|
|
@@ -18,6 +17,7 @@ import {
|
|
|
18
17
|
countSubAgentsByParent,
|
|
19
18
|
isAgentRunning,
|
|
20
19
|
SEARCH_ANIM_MS,
|
|
20
|
+
SEARCH_CLOSE_ANIM_MS,
|
|
21
21
|
SEARCH_TITLE_GAP,
|
|
22
22
|
type AgentGroup,
|
|
23
23
|
type AgentShowField,
|
|
@@ -26,6 +26,9 @@ import {
|
|
|
26
26
|
} from "./constants.ts";
|
|
27
27
|
import { formatAgentMeta } from "./filters.ts";
|
|
28
28
|
import type { WorkspaceTheme } from "./constants.ts";
|
|
29
|
+
import { ICON_SIZE } from "../design-tokens.ts";
|
|
30
|
+
import { IconButton } from "../ui.tsx";
|
|
31
|
+
import { useMessages } from "../use-app-language.ts";
|
|
29
32
|
|
|
30
33
|
export type AgentsSectionStyles = AgentRowStyles & {
|
|
31
34
|
agentsSection: ViewStyle;
|
|
@@ -160,6 +163,7 @@ export function AgentsSection({
|
|
|
160
163
|
/** Bump when workspace changes to collapse search. */
|
|
161
164
|
resetKey: string;
|
|
162
165
|
}): ReactNode {
|
|
166
|
+
const m = useMessages();
|
|
163
167
|
const [agentSearchOpen, setAgentSearchOpen] = useState(false);
|
|
164
168
|
const [searchSlotWidth, setSearchSlotWidth] = useState(0);
|
|
165
169
|
const [pageIndex, setPageIndex] = useState(0);
|
|
@@ -198,8 +202,8 @@ export function AgentsSection({
|
|
|
198
202
|
if (!agentSearchOpen) return;
|
|
199
203
|
Animated.timing(searchProgress, {
|
|
200
204
|
toValue: 0,
|
|
201
|
-
duration:
|
|
202
|
-
easing: Easing.
|
|
205
|
+
duration: SEARCH_CLOSE_ANIM_MS,
|
|
206
|
+
easing: Easing.out(Easing.cubic),
|
|
203
207
|
useNativeDriver: false,
|
|
204
208
|
}).start(({ finished }) => {
|
|
205
209
|
if (!finished) return;
|
|
@@ -225,8 +229,8 @@ export function AgentsSection({
|
|
|
225
229
|
else active.push(item);
|
|
226
230
|
}
|
|
227
231
|
const groups: Array<[string, AgentUsageItem[]]> = [];
|
|
228
|
-
if (active.length > 0) groups.push([
|
|
229
|
-
if (archived.length > 0) groups.push([
|
|
232
|
+
if (active.length > 0) groups.push([m.workspace.options.status.active, active]);
|
|
233
|
+
if (archived.length > 0) groups.push([m.workspace.options.status.archived, archived]);
|
|
230
234
|
return groups;
|
|
231
235
|
}
|
|
232
236
|
const map = new Map<string, AgentUsageItem[]>();
|
|
@@ -238,7 +242,7 @@ export function AgentsSection({
|
|
|
238
242
|
return [...map.entries()].sort((a, b) =>
|
|
239
243
|
providerLabel(a[0]).localeCompare(providerLabel(b[0])),
|
|
240
244
|
);
|
|
241
|
-
}, [agentGroup, pageItems]);
|
|
245
|
+
}, [agentGroup, pageItems, m]);
|
|
242
246
|
|
|
243
247
|
const subAgentCounts = useMemo(
|
|
244
248
|
() => countSubAgentsByParent(agentItems, statusFilters),
|
|
@@ -270,7 +274,7 @@ export function AgentsSection({
|
|
|
270
274
|
<View style={styles.agentsSection}>
|
|
271
275
|
<View style={styles.agentsHeaderWrap}>
|
|
272
276
|
<View style={styles.agentsHeaderRow}>
|
|
273
|
-
<Text style={styles.sectionTitle}>
|
|
277
|
+
<Text style={styles.sectionTitle}>{m.common.agents}</Text>
|
|
274
278
|
<View
|
|
275
279
|
style={styles.agentsHeaderSearchSlot}
|
|
276
280
|
onLayout={(event) => {
|
|
@@ -295,51 +299,41 @@ export function AgentsSection({
|
|
|
295
299
|
},
|
|
296
300
|
]}
|
|
297
301
|
>
|
|
298
|
-
<Icon name="Search" size={
|
|
302
|
+
<Icon name="Search" size={ICON_SIZE.inline} color={theme.colors.foregroundMuted} />
|
|
299
303
|
<TextInput
|
|
300
304
|
ref={searchInputRef as never}
|
|
301
305
|
value={searchQuery}
|
|
302
306
|
onChangeText={onSearchQueryChange}
|
|
303
|
-
placeholder=
|
|
307
|
+
placeholder={m.workspace.searchPlaceholder}
|
|
304
308
|
placeholderTextColor={theme.colors.foregroundMuted}
|
|
305
309
|
autoCapitalize="none"
|
|
306
310
|
autoCorrect={false}
|
|
307
311
|
returnKeyType="search"
|
|
308
312
|
editable={agentSearchOpen}
|
|
309
313
|
style={styles.searchInput}
|
|
310
|
-
accessibilityLabel=
|
|
314
|
+
accessibilityLabel={m.workspace.searchLabel}
|
|
311
315
|
/>
|
|
312
316
|
</Animated.View>
|
|
313
317
|
</View>
|
|
314
318
|
<View style={styles.headerActions}>
|
|
315
|
-
<
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
hitSlop={8}
|
|
319
|
+
<IconButton
|
|
320
|
+
icon={agentSearchOpen ? "X" : "Search"}
|
|
321
|
+
label={agentSearchOpen ? m.workspace.closeSearch : m.workspace.openSearch}
|
|
322
|
+
expanded={agentSearchOpen}
|
|
320
323
|
onPress={() => {
|
|
321
324
|
if (agentSearchOpen) closeAgentSearch();
|
|
322
325
|
else openAgentSearch();
|
|
323
326
|
}}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
<Icon
|
|
327
|
-
name={agentSearchOpen ? "X" : "Search"}
|
|
328
|
-
size={14}
|
|
329
|
-
color={theme.colors.foregroundMuted}
|
|
330
|
-
/>
|
|
331
|
-
</Pressable>
|
|
327
|
+
color={theme.colors.foregroundMuted}
|
|
328
|
+
/>
|
|
332
329
|
<View ref={triggerRef} collapsable={false}>
|
|
333
|
-
<
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
hitSlop={8}
|
|
330
|
+
<IconButton
|
|
331
|
+
icon="Settings2"
|
|
332
|
+
label={m.workspace.displayOptions}
|
|
333
|
+
expanded={menuOpen}
|
|
338
334
|
onPress={onToggleMenu}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
<Icon name="Settings2" size={14} color={theme.colors.foregroundMuted} />
|
|
342
|
-
</Pressable>
|
|
335
|
+
color={theme.colors.foregroundMuted}
|
|
336
|
+
/>
|
|
343
337
|
</View>
|
|
344
338
|
</View>
|
|
345
339
|
</View>
|
|
@@ -357,39 +351,30 @@ export function AgentsSection({
|
|
|
357
351
|
: pageItems.map(renderAgentRow)}
|
|
358
352
|
{visibleAgentItems.length === 0 ? (
|
|
359
353
|
<Text style={styles.empty}>
|
|
360
|
-
{statusFiltersEmpty ?
|
|
354
|
+
{statusFiltersEmpty ? m.workspace.noFilters : m.workspace.noMatches}
|
|
361
355
|
</Text>
|
|
362
356
|
) : null}
|
|
363
357
|
{showPager ? (
|
|
364
358
|
<View style={styles.pagerRow}>
|
|
365
|
-
<
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
accessibilityState={{ disabled: safePage === 0 }}
|
|
369
|
-
disabled={safePage === 0}
|
|
370
|
-
hitSlop={8}
|
|
359
|
+
<IconButton
|
|
360
|
+
icon="ChevronLeft"
|
|
361
|
+
label={m.workspace.previousPage}
|
|
371
362
|
onPress={() => setPageIndex((p) => Math.max(0, p - 1))}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
363
|
+
color={theme.colors.foregroundMuted}
|
|
364
|
+
disabled={safePage === 0}
|
|
365
|
+
style={safePage === 0 ? styles.pagerButtonDisabled : undefined}
|
|
366
|
+
/>
|
|
376
367
|
<Text style={styles.pagerLabel}>
|
|
377
368
|
{safePage + 1} / {pageCount}
|
|
378
369
|
</Text>
|
|
379
|
-
<
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
accessibilityState={{ disabled: safePage >= pageCount - 1 }}
|
|
383
|
-
disabled={safePage >= pageCount - 1}
|
|
384
|
-
hitSlop={8}
|
|
370
|
+
<IconButton
|
|
371
|
+
icon="ChevronRight"
|
|
372
|
+
label={m.workspace.nextPage}
|
|
385
373
|
onPress={() => setPageIndex((p) => Math.min(pageCount - 1, p + 1))}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
>
|
|
391
|
-
<Icon name="ChevronRight" size={14} color={theme.colors.foregroundMuted} />
|
|
392
|
-
</Pressable>
|
|
374
|
+
color={theme.colors.foregroundMuted}
|
|
375
|
+
disabled={safePage >= pageCount - 1}
|
|
376
|
+
style={safePage >= pageCount - 1 ? styles.pagerButtonDisabled : undefined}
|
|
377
|
+
/>
|
|
393
378
|
</View>
|
|
394
379
|
) : null}
|
|
395
380
|
</View>
|
|
@@ -81,11 +81,12 @@ export type MenuOption = { id: string; label: string; icon: string };
|
|
|
81
81
|
/** Agents header row / search pill height — keep fixed to avoid layout jump. */
|
|
82
82
|
export const AGENT_HEADER_HEIGHT = 28;
|
|
83
83
|
export const SEARCH_ANIM_MS = 220;
|
|
84
|
+
/** Closing stays faster than opening (084). */
|
|
85
|
+
export const SEARCH_CLOSE_ANIM_MS = 160;
|
|
84
86
|
export const SEARCH_TITLE_GAP = 8;
|
|
85
87
|
/** Host MenuFlyout overlap between root surface and submenu (`SUBMENU_OVERLAP`). */
|
|
86
88
|
export const MENU_SUBMENU_OVERLAP = 5;
|
|
87
89
|
export const MENU_WIDTH = 232;
|
|
88
|
-
export const MENU_OPTION_ICON_SIZE = 14;
|
|
89
90
|
/** Approx list-row height (padding + title/meta) for stable Skills/MCP section size. */
|
|
90
91
|
export const RANK_ROW_ESTIMATE = 42;
|
|
91
92
|
/** Visible agents per page in Explorer; pager hidden when pageCount ≤ 1. */
|
|
@@ -131,11 +132,12 @@ export const LIFECYCLE_FILTER_OPTIONS: ReadonlyArray<
|
|
|
131
132
|
{ id: "closed", label: "Closed", icon: "CircleOff" },
|
|
132
133
|
];
|
|
133
134
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
id: T
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
/** Swap option labels for localized copy (066); ids / icons unchanged. */
|
|
136
|
+
export function localizeOptions<T extends string>(
|
|
137
|
+
options: ReadonlyArray<MenuOption & { id: T }>,
|
|
138
|
+
labels: Record<T, string>,
|
|
139
|
+
): ReadonlyArray<MenuOption & { id: T }> {
|
|
140
|
+
return options.map((option) => ({ ...option, label: labels[option.id] ?? option.label }));
|
|
139
141
|
}
|
|
140
142
|
|
|
141
143
|
/** 0 = attention-worthy, then running / idle / initializing / closed (unknown). */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Icon } from "@getpaseo/plugin/client/
|
|
1
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import { Pressable, Text, View, type TextStyle, type ViewStyle } from "react-native";
|
|
4
|
-
import {
|
|
4
|
+
import { type MenuOption } from "./constants.ts";
|
|
5
|
+
import { ICON_SIZE } from "../design-tokens.ts";
|
|
5
6
|
|
|
6
7
|
export type MenuStyles = {
|
|
7
8
|
menuPage: ViewStyle;
|
|
@@ -57,7 +58,7 @@ export function MenuSubTrigger({
|
|
|
57
58
|
{value}
|
|
58
59
|
</Text>
|
|
59
60
|
) : null}
|
|
60
|
-
<Icon name="ChevronRight" size={
|
|
61
|
+
<Icon name="ChevronRight" size={ICON_SIZE.inline} color={chevronColor} />
|
|
61
62
|
</View>
|
|
62
63
|
</Pressable>
|
|
63
64
|
</View>
|
|
@@ -98,14 +99,14 @@ export function MenuOptionList({
|
|
|
98
99
|
]}
|
|
99
100
|
>
|
|
100
101
|
<View style={styles.menuLeadingSlot}>
|
|
101
|
-
<Icon name={option.icon} size={
|
|
102
|
+
<Icon name={option.icon} size={ICON_SIZE.inline} color={iconColor} />
|
|
102
103
|
</View>
|
|
103
104
|
<Text style={styles.menuOptionLabel} numberOfLines={1}>
|
|
104
105
|
{option.label}
|
|
105
106
|
</Text>
|
|
106
107
|
{selected ? (
|
|
107
108
|
<View style={styles.menuTrailing}>
|
|
108
|
-
<Icon name="Check" size={
|
|
109
|
+
<Icon name="Check" size={ICON_SIZE.action} color={checkColor} />
|
|
109
110
|
</View>
|
|
110
111
|
) : null}
|
|
111
112
|
</Pressable>
|
|
@@ -42,7 +42,7 @@ test("formatAgentMeta joins selected fields; prompt last", () => {
|
|
|
42
42
|
assert.equal(formatAgentMeta(item, fields(), byId, "en-US"), null);
|
|
43
43
|
assert.equal(
|
|
44
44
|
formatAgentMeta(item, fields("messages", "prompt"), byId, "en-US", "ship it"),
|
|
45
|
-
"5
|
|
45
|
+
"5 prompts · ship it",
|
|
46
46
|
);
|
|
47
47
|
assert.equal(
|
|
48
48
|
formatAgentMeta(item, fields("prompt"), byId, "en-US", null),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { matchesAgentTitleSearch } from "../../shared/agent-title-search.ts";
|
|
2
2
|
import { formatActivityTime } from "../../shared/format.ts";
|
|
3
|
+
import { messagesFor } from "../../shared/i18n.ts";
|
|
3
4
|
import { providerLabel, type AgentUsageItem } from "../../shared/usage.ts";
|
|
4
5
|
import {
|
|
5
6
|
type AgentShowField,
|
|
@@ -23,9 +24,10 @@ export function formatAgentMeta(
|
|
|
23
24
|
promptPreview?: string | null,
|
|
24
25
|
): string | null {
|
|
25
26
|
const parts: string[] = [];
|
|
27
|
+
const { units } = messagesFor(locale);
|
|
26
28
|
if (showFields.has("provider")) parts.push(providerLabel(item.provider));
|
|
27
|
-
if (showFields.has("calls")) parts.push(
|
|
28
|
-
if (showFields.has("messages")) parts.push(
|
|
29
|
+
if (showFields.has("calls")) parts.push(units.calls(item.callCount));
|
|
30
|
+
if (showFields.has("messages")) parts.push(units.prompts(item.messageCount));
|
|
29
31
|
if (showFields.has("updated")) {
|
|
30
32
|
const at = agentUpdatedAt(item, byId);
|
|
31
33
|
if (at) parts.push(formatActivityTime(at, locale));
|