@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.
- package/CHANGELOG.md +35 -1
- package/README.md +14 -7
- package/client/activity-heatmap.tsx +115 -74
- package/client/agent-creations.tsx +97 -88
- package/client/attention-pill.tsx +16 -5
- package/client/attention-popover.tsx +19 -23
- package/client/design-tokens.test.ts +39 -0
- package/client/design-tokens.ts +168 -0
- package/client/formatted-time.tsx +4 -4
- package/client/global-surface.tsx +236 -268
- package/client/header-button.ts +136 -0
- package/client/hourly-activity-timeline.tsx +136 -103
- package/client/panel-visibility.test.ts +25 -0
- package/client/panel-visibility.ts +45 -0
- package/client/panel.tsx +83 -108
- package/client/provider-dropdown.tsx +131 -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 +291 -0
- package/client/ui.tsx +339 -0
- package/client/usage-popover.tsx +62 -134
- 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 +18 -25
- package/client/workspace/agents-section.tsx +23 -20
- package/client/workspace/constants.ts +6 -6
- package/client/workspace/display-menu.tsx +5 -4
- package/client/workspace/filters.test.ts +1 -1
- package/client/workspace/filters.ts +4 -2
- package/client/workspace/panel.tsx +89 -103
- package/client/workspace/rank-section.tsx +36 -62
- package/client/workspace/terminals-section.tsx +13 -9
- package/index.client.tsx +40 -20
- package/index.server.ts +53 -51
- package/package.json +2 -2
- 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/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/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 +124 -63
- package/shared/usage.test.ts +121 -0
- package/shared/usage.ts +191 -2
|
@@ -8,14 +8,13 @@ import { useToast } from "@getpaseo/plugin/client/react-native";
|
|
|
8
8
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
9
9
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
10
10
|
import { useRegisterOpenAgent } from "../open-agent.ts";
|
|
11
|
+
import { usePanelPresenceReport } from "../panel-visibility.ts";
|
|
11
12
|
import { useWorkspaceAgentStatuses } from "../use-workspace-agent-statuses.ts";
|
|
12
13
|
import {
|
|
13
|
-
ActivityIndicator,
|
|
14
14
|
Dimensions,
|
|
15
15
|
Platform,
|
|
16
16
|
Pressable,
|
|
17
17
|
ScrollView,
|
|
18
|
-
Text,
|
|
19
18
|
View,
|
|
20
19
|
} from "react-native";
|
|
21
20
|
import { ACTIVITY_LIST_LIMIT } from "../../shared/insights.ts";
|
|
@@ -36,6 +35,8 @@ import {
|
|
|
36
35
|
usageSummaryRpc,
|
|
37
36
|
} from "../../shared/usage.ts";
|
|
38
37
|
import { useAppLanguage } from "../use-app-language.ts";
|
|
38
|
+
import { messagesFor } from "../../shared/i18n.ts";
|
|
39
|
+
import { ErrorState, InlineEmpty, LoadingState } from "../ui.tsx";
|
|
39
40
|
import { useWorkspaceActivityRefresh } from "../use-agent-turn-end.ts";
|
|
40
41
|
import { UsageStats } from "../usage-stats.tsx";
|
|
41
42
|
import { AgentsSection } from "./agents-section.tsx";
|
|
@@ -51,8 +52,8 @@ import {
|
|
|
51
52
|
STATUS_FILTER_OPTIONS,
|
|
52
53
|
TERMINAL_REFETCH_MS,
|
|
53
54
|
agentUpdatedAt,
|
|
55
|
+
localizeOptions,
|
|
54
56
|
matchesAgentFilters,
|
|
55
|
-
optionLabel,
|
|
56
57
|
type AgentGroup,
|
|
57
58
|
type AgentLifecycleFilter,
|
|
58
59
|
type AgentShowField,
|
|
@@ -65,11 +66,22 @@ import { MenuOptionList, MenuSubTrigger } from "./display-menu.tsx";
|
|
|
65
66
|
import { matchesAgentTitle } from "./filters.ts";
|
|
66
67
|
import { RankSection } from "./rank-section.tsx";
|
|
67
68
|
import { TerminalsSection, type TerminalListItem } from "./terminals-section.tsx";
|
|
69
|
+
import {
|
|
70
|
+
CONTROL,
|
|
71
|
+
FONT_WEIGHT,
|
|
72
|
+
ICON_SIZE,
|
|
73
|
+
RADIUS,
|
|
74
|
+
ROW_PADDING,
|
|
75
|
+
TEXT,
|
|
76
|
+
iconButton,
|
|
77
|
+
pageLayout,
|
|
78
|
+
pillRadius,
|
|
79
|
+
sectionTitle,
|
|
80
|
+
titleGap,
|
|
81
|
+
} from "../design-tokens.ts";
|
|
68
82
|
|
|
69
83
|
type RankKind = "skills" | "mcp";
|
|
70
84
|
|
|
71
|
-
const MONO = Platform.select({ ios: "Menlo", default: "monospace" });
|
|
72
|
-
|
|
73
85
|
/** Workspace-scoped Activity for the Explorer (024 / 031). */
|
|
74
86
|
export function WorkspaceActivityPanel({
|
|
75
87
|
theme,
|
|
@@ -104,12 +116,14 @@ export function WorkspaceActivityPanel({
|
|
|
104
116
|
const [rankKind, setRankKind] = useState<RankKind>("skills");
|
|
105
117
|
const [busyAgentId, setBusyAgentId] = useState<string | null>(null);
|
|
106
118
|
const [busyTerminalId, setBusyTerminalId] = useState<string | null>(null);
|
|
107
|
-
const
|
|
119
|
+
const page = pageLayout("panel", layout.compact);
|
|
108
120
|
const locale = useAppLanguage();
|
|
121
|
+
const m = messagesFor(locale);
|
|
109
122
|
const toast = useToast();
|
|
110
123
|
const queryClient = useQueryClient();
|
|
111
124
|
const openAgent = navigation?.openAgent;
|
|
112
125
|
useRegisterOpenAgent(openAgent);
|
|
126
|
+
usePanelPresenceReport(workspaceId);
|
|
113
127
|
const rootRef = useRef<View>(null);
|
|
114
128
|
const triggerRef = useRef<View>(null);
|
|
115
129
|
|
|
@@ -297,14 +311,16 @@ export function WorkspaceActivityPanel({
|
|
|
297
311
|
recentMcpCalls.error;
|
|
298
312
|
|
|
299
313
|
const kpi = [
|
|
300
|
-
{ label:
|
|
301
|
-
{ label:
|
|
302
|
-
{ label:
|
|
303
|
-
{
|
|
304
|
-
label: "Messages",
|
|
305
|
-
value: (summary.data?.messageCount ?? 0).toLocaleString(),
|
|
306
|
-
},
|
|
314
|
+
{ label: m.kpi.shellCalls, value: (summary.data?.shellCalls ?? 0).toLocaleString(locale) },
|
|
315
|
+
{ label: m.kpi.fileReads, value: (summary.data?.fileReads ?? 0).toLocaleString(locale) },
|
|
316
|
+
{ label: m.kpi.fileWrites, value: (summary.data?.fileWrites ?? 0).toLocaleString(locale) },
|
|
317
|
+
{ label: m.kpi.prompts, value: (summary.data?.messageCount ?? 0).toLocaleString(locale) },
|
|
307
318
|
];
|
|
319
|
+
const retry = () => {
|
|
320
|
+
for (const query of [summary, agents, skills, recentSkillCalls, mcp, recentMcpCalls]) {
|
|
321
|
+
if (query.error) void query.refetch();
|
|
322
|
+
}
|
|
323
|
+
};
|
|
308
324
|
|
|
309
325
|
const terminalItems = terminals.data?.entries ?? [];
|
|
310
326
|
const showAgents = agentItems.length > 0;
|
|
@@ -331,7 +347,7 @@ export function WorkspaceActivityPanel({
|
|
|
331
347
|
minHeight: 0,
|
|
332
348
|
minWidth: 0,
|
|
333
349
|
overflow: "hidden" as const,
|
|
334
|
-
backgroundColor:
|
|
350
|
+
backgroundColor: "transparent",
|
|
335
351
|
},
|
|
336
352
|
scroll: {
|
|
337
353
|
flex: 1,
|
|
@@ -342,9 +358,9 @@ export function WorkspaceActivityPanel({
|
|
|
342
358
|
: null),
|
|
343
359
|
},
|
|
344
360
|
content: {
|
|
345
|
-
padding,
|
|
346
|
-
paddingBottom: padding + 24,
|
|
347
|
-
gap:
|
|
361
|
+
padding: page.padding,
|
|
362
|
+
paddingBottom: page.padding + 24,
|
|
363
|
+
gap: page.gap,
|
|
348
364
|
maxWidth: 1000,
|
|
349
365
|
width: "100%" as const,
|
|
350
366
|
alignSelf: "center" as const,
|
|
@@ -367,14 +383,7 @@ export function WorkspaceActivityPanel({
|
|
|
367
383
|
justifyContent: "flex-end" as const,
|
|
368
384
|
overflow: "hidden" as const,
|
|
369
385
|
},
|
|
370
|
-
titleAction:
|
|
371
|
-
width: 24,
|
|
372
|
-
height: 24,
|
|
373
|
-
alignItems: "center" as const,
|
|
374
|
-
justifyContent: "center" as const,
|
|
375
|
-
borderRadius: 6,
|
|
376
|
-
flexShrink: 0,
|
|
377
|
-
},
|
|
386
|
+
titleAction: iconButton,
|
|
378
387
|
headerActions: {
|
|
379
388
|
flexDirection: "row" as const,
|
|
380
389
|
alignItems: "center" as const,
|
|
@@ -388,7 +397,7 @@ export function WorkspaceActivityPanel({
|
|
|
388
397
|
gap: 6,
|
|
389
398
|
height: AGENT_HEADER_HEIGHT,
|
|
390
399
|
paddingHorizontal: 10,
|
|
391
|
-
borderRadius: AGENT_HEADER_HEIGHT
|
|
400
|
+
borderRadius: pillRadius(AGENT_HEADER_HEIGHT),
|
|
392
401
|
borderWidth: 1,
|
|
393
402
|
borderColor: theme.colors.border,
|
|
394
403
|
backgroundColor: theme.colors.surface1,
|
|
@@ -399,17 +408,15 @@ export function WorkspaceActivityPanel({
|
|
|
399
408
|
minWidth: 0,
|
|
400
409
|
padding: 0,
|
|
401
410
|
margin: 0,
|
|
411
|
+
...TEXT.small,
|
|
402
412
|
color: theme.colors.foreground,
|
|
403
|
-
fontSize: 13,
|
|
404
413
|
lineHeight: 18,
|
|
405
414
|
...(Platform.OS === "web" ? ({ outlineStyle: "none" } as object) : null),
|
|
406
415
|
},
|
|
407
416
|
sectionTitle: {
|
|
417
|
+
...sectionTitle(layout.compact),
|
|
408
418
|
color: theme.colors.foreground,
|
|
409
|
-
fontSize: 16,
|
|
410
|
-
fontWeight: "600" as const,
|
|
411
419
|
flexShrink: 0,
|
|
412
|
-
letterSpacing: -0.3,
|
|
413
420
|
lineHeight: AGENT_HEADER_HEIGHT,
|
|
414
421
|
},
|
|
415
422
|
panel: {
|
|
@@ -420,7 +427,7 @@ export function WorkspaceActivityPanel({
|
|
|
420
427
|
flexDirection: "row" as const,
|
|
421
428
|
alignItems: "center" as const,
|
|
422
429
|
gap: 12,
|
|
423
|
-
paddingVertical:
|
|
430
|
+
paddingVertical: ROW_PADDING.dense,
|
|
424
431
|
},
|
|
425
432
|
timelineMarker: {
|
|
426
433
|
width: 18,
|
|
@@ -446,17 +453,17 @@ export function WorkspaceActivityPanel({
|
|
|
446
453
|
zIndex: 1,
|
|
447
454
|
width: 7,
|
|
448
455
|
height: 7,
|
|
449
|
-
borderRadius:
|
|
456
|
+
borderRadius: pillRadius(7),
|
|
450
457
|
},
|
|
451
458
|
agentListRow: {
|
|
452
459
|
flexDirection: "row" as const,
|
|
453
460
|
alignItems: "center" as const,
|
|
454
461
|
gap: 10,
|
|
455
|
-
paddingVertical:
|
|
462
|
+
paddingVertical: ROW_PADDING.dense,
|
|
456
463
|
},
|
|
457
464
|
agentIconWrap: {
|
|
458
|
-
width:
|
|
459
|
-
height:
|
|
465
|
+
width: ICON_SIZE.leading,
|
|
466
|
+
height: ICON_SIZE.leading,
|
|
460
467
|
alignItems: "center" as const,
|
|
461
468
|
justifyContent: "center" as const,
|
|
462
469
|
},
|
|
@@ -466,7 +473,7 @@ export function WorkspaceActivityPanel({
|
|
|
466
473
|
bottom: -4,
|
|
467
474
|
width: 13,
|
|
468
475
|
height: 13,
|
|
469
|
-
borderRadius:
|
|
476
|
+
borderRadius: pillRadius(13),
|
|
470
477
|
alignItems: "center" as const,
|
|
471
478
|
justifyContent: "center" as const,
|
|
472
479
|
backgroundColor: theme.colors.surface0,
|
|
@@ -478,7 +485,7 @@ export function WorkspaceActivityPanel({
|
|
|
478
485
|
minWidth: 14,
|
|
479
486
|
height: 14,
|
|
480
487
|
paddingHorizontal: 3,
|
|
481
|
-
borderRadius:
|
|
488
|
+
borderRadius: pillRadius(14),
|
|
482
489
|
alignItems: "center" as const,
|
|
483
490
|
justifyContent: "center" as const,
|
|
484
491
|
backgroundColor: theme.colors.surface0,
|
|
@@ -486,11 +493,8 @@ export function WorkspaceActivityPanel({
|
|
|
486
493
|
borderColor: theme.colors.border,
|
|
487
494
|
},
|
|
488
495
|
subAgentBadgeText: {
|
|
496
|
+
...TEXT.iconBadge,
|
|
489
497
|
color: theme.colors.foregroundMuted,
|
|
490
|
-
fontSize: 9,
|
|
491
|
-
fontWeight: "700" as const,
|
|
492
|
-
fontVariant: ["tabular-nums" as const],
|
|
493
|
-
lineHeight: 11,
|
|
494
498
|
},
|
|
495
499
|
listMain: {
|
|
496
500
|
flex: 1,
|
|
@@ -498,76 +502,69 @@ export function WorkspaceActivityPanel({
|
|
|
498
502
|
gap: 3,
|
|
499
503
|
},
|
|
500
504
|
listTitle: {
|
|
505
|
+
...TEXT.rowTitle,
|
|
501
506
|
color: theme.colors.foreground,
|
|
502
|
-
fontSize: 14,
|
|
503
|
-
fontWeight: "500" as const,
|
|
504
507
|
},
|
|
505
508
|
listLink: {
|
|
509
|
+
...TEXT.rowTitle,
|
|
506
510
|
color: theme.colors.foreground,
|
|
507
|
-
fontSize: 14,
|
|
508
|
-
fontWeight: "500" as const,
|
|
509
511
|
},
|
|
510
512
|
listMeta: {
|
|
513
|
+
...TEXT.meta,
|
|
511
514
|
color: theme.colors.foregroundMuted,
|
|
512
|
-
fontSize: 12,
|
|
513
515
|
},
|
|
514
516
|
permissionBadge: {
|
|
515
517
|
flexDirection: "row" as const,
|
|
516
518
|
alignItems: "center" as const,
|
|
517
519
|
gap: 3,
|
|
518
|
-
height:
|
|
520
|
+
height: CONTROL.pillBadgeHeight,
|
|
519
521
|
paddingHorizontal: 5,
|
|
520
|
-
borderRadius:
|
|
522
|
+
borderRadius: pillRadius(CONTROL.pillBadgeHeight),
|
|
521
523
|
borderWidth: 1,
|
|
522
524
|
borderColor: theme.colors.border,
|
|
523
525
|
backgroundColor: theme.colors.surface1,
|
|
524
526
|
flexShrink: 0,
|
|
525
527
|
},
|
|
526
528
|
permissionBadgeText: {
|
|
529
|
+
...TEXT.pillBadge,
|
|
527
530
|
color: theme.colors.statusWarning,
|
|
528
|
-
fontSize: 11,
|
|
529
|
-
fontWeight: "600" as const,
|
|
530
|
-
fontVariant: ["tabular-nums" as const],
|
|
531
531
|
},
|
|
532
532
|
terminalRow: {
|
|
533
533
|
flexDirection: "row" as const,
|
|
534
534
|
alignItems: "center" as const,
|
|
535
535
|
gap: 10,
|
|
536
|
-
paddingVertical:
|
|
536
|
+
paddingVertical: ROW_PADDING.dense,
|
|
537
537
|
},
|
|
538
538
|
terminalPreview: {
|
|
539
539
|
marginLeft: 28,
|
|
540
540
|
marginBottom: 4,
|
|
541
541
|
paddingVertical: 8,
|
|
542
542
|
paddingHorizontal: 10,
|
|
543
|
-
borderRadius:
|
|
543
|
+
borderRadius: RADIUS.control,
|
|
544
544
|
backgroundColor: theme.colors.surface1,
|
|
545
545
|
gap: 2,
|
|
546
546
|
},
|
|
547
547
|
terminalLine: {
|
|
548
|
+
...TEXT.terminal,
|
|
548
549
|
color: theme.colors.foregroundMuted,
|
|
549
|
-
fontFamily: MONO,
|
|
550
|
-
fontSize: 11,
|
|
551
|
-
lineHeight: 15,
|
|
552
550
|
},
|
|
553
551
|
countText: {
|
|
552
|
+
...TEXT.count,
|
|
554
553
|
color: theme.colors.foregroundMuted,
|
|
555
|
-
fontSize: 13,
|
|
556
|
-
fontVariant: ["tabular-nums" as const],
|
|
557
554
|
minWidth: 24,
|
|
558
555
|
textAlign: "right" as const,
|
|
559
556
|
},
|
|
560
557
|
empty: {
|
|
558
|
+
...TEXT.small,
|
|
561
559
|
color: theme.colors.foregroundMuted,
|
|
562
|
-
fontSize: 13,
|
|
563
560
|
},
|
|
564
561
|
agentGroup: {
|
|
565
562
|
gap: 4,
|
|
566
563
|
},
|
|
567
564
|
groupLabel: {
|
|
565
|
+
...TEXT.meta,
|
|
568
566
|
color: theme.colors.foregroundMuted,
|
|
569
|
-
|
|
570
|
-
fontWeight: "600" as const,
|
|
567
|
+
fontWeight: FONT_WEIGHT.semibold,
|
|
571
568
|
paddingTop: 12,
|
|
572
569
|
paddingBottom: 2,
|
|
573
570
|
},
|
|
@@ -579,20 +576,13 @@ export function WorkspaceActivityPanel({
|
|
|
579
576
|
paddingTop: 8,
|
|
580
577
|
paddingBottom: 4,
|
|
581
578
|
},
|
|
582
|
-
pagerButton:
|
|
583
|
-
width: 28,
|
|
584
|
-
height: 28,
|
|
585
|
-
alignItems: "center" as const,
|
|
586
|
-
justifyContent: "center" as const,
|
|
587
|
-
borderRadius: 6,
|
|
588
|
-
},
|
|
579
|
+
pagerButton: iconButton,
|
|
589
580
|
pagerButtonDisabled: {
|
|
590
581
|
opacity: 0.35,
|
|
591
582
|
},
|
|
592
583
|
pagerLabel: {
|
|
584
|
+
...TEXT.tabularMeta,
|
|
593
585
|
color: theme.colors.foregroundMuted,
|
|
594
|
-
fontSize: 12,
|
|
595
|
-
fontVariant: ["tabular-nums" as const],
|
|
596
586
|
},
|
|
597
587
|
menuPage: {
|
|
598
588
|
paddingVertical: 4,
|
|
@@ -607,7 +597,7 @@ export function WorkspaceActivityPanel({
|
|
|
607
597
|
paddingVertical: 4,
|
|
608
598
|
borderWidth: 1,
|
|
609
599
|
borderColor: "transparent",
|
|
610
|
-
borderRadius:
|
|
600
|
+
borderRadius: RADIUS.control,
|
|
611
601
|
},
|
|
612
602
|
menuRowHighlighted: {
|
|
613
603
|
backgroundColor: theme.colors.surface2,
|
|
@@ -615,15 +605,12 @@ export function WorkspaceActivityPanel({
|
|
|
615
605
|
menuLabel: {
|
|
616
606
|
flexShrink: 1,
|
|
617
607
|
minWidth: 0,
|
|
608
|
+
...TEXT.menu,
|
|
618
609
|
color: theme.colors.foreground,
|
|
619
|
-
fontSize: 14,
|
|
620
|
-
lineHeight: 18,
|
|
621
|
-
fontWeight: "normal" as const,
|
|
622
610
|
},
|
|
623
611
|
menuValue: {
|
|
612
|
+
...TEXT.menu,
|
|
624
613
|
color: theme.colors.foregroundMuted,
|
|
625
|
-
fontSize: 14,
|
|
626
|
-
lineHeight: 18,
|
|
627
614
|
flexShrink: 1,
|
|
628
615
|
},
|
|
629
616
|
menuTrailing: {
|
|
@@ -643,23 +630,24 @@ export function WorkspaceActivityPanel({
|
|
|
643
630
|
paddingVertical: 4,
|
|
644
631
|
borderWidth: 1,
|
|
645
632
|
borderColor: "transparent",
|
|
646
|
-
borderRadius:
|
|
633
|
+
borderRadius: RADIUS.control,
|
|
647
634
|
},
|
|
648
635
|
menuOptionLabel: {
|
|
649
636
|
flexShrink: 1,
|
|
650
637
|
minWidth: 0,
|
|
638
|
+
...TEXT.menu,
|
|
651
639
|
color: theme.colors.foreground,
|
|
652
|
-
fontSize: 14,
|
|
653
|
-
lineHeight: 18,
|
|
654
|
-
fontWeight: "normal" as const,
|
|
655
640
|
},
|
|
656
641
|
menuLeadingSlot: {
|
|
657
642
|
width: 16,
|
|
658
643
|
alignItems: "center" as const,
|
|
659
644
|
justifyContent: "center" as const,
|
|
660
645
|
},
|
|
646
|
+
section: {
|
|
647
|
+
gap: titleGap(layout.compact),
|
|
648
|
+
},
|
|
661
649
|
agentsSection: {
|
|
662
|
-
gap:
|
|
650
|
+
gap: titleGap(layout.compact),
|
|
663
651
|
position: "relative" as const,
|
|
664
652
|
},
|
|
665
653
|
agentsHeaderWrap: {
|
|
@@ -675,7 +663,7 @@ export function WorkspaceActivityPanel({
|
|
|
675
663
|
},
|
|
676
664
|
menuSurface: {
|
|
677
665
|
width: MENU_WIDTH,
|
|
678
|
-
borderRadius:
|
|
666
|
+
borderRadius: RADIUS.overlay,
|
|
679
667
|
borderWidth: 1,
|
|
680
668
|
borderColor: theme.colors.border,
|
|
681
669
|
backgroundColor: theme.colors.surface1,
|
|
@@ -701,7 +689,7 @@ export function WorkspaceActivityPanel({
|
|
|
701
689
|
backgroundColor: theme.colors.border,
|
|
702
690
|
},
|
|
703
691
|
}),
|
|
704
|
-
[theme, layout.compact, padding],
|
|
692
|
+
[theme, layout.compact, page.padding, page.gap],
|
|
705
693
|
);
|
|
706
694
|
|
|
707
695
|
const rowHeight = layout.compact ? 40 : 28;
|
|
@@ -712,15 +700,15 @@ export function WorkspaceActivityPanel({
|
|
|
712
700
|
: 0;
|
|
713
701
|
const flyoutOptions: ReadonlyArray<MenuOption> =
|
|
714
702
|
menuFlyout === "sort"
|
|
715
|
-
? SORT_OPTIONS
|
|
703
|
+
? localizeOptions(SORT_OPTIONS, m.workspace.options.sort)
|
|
716
704
|
: menuFlyout === "group"
|
|
717
|
-
? GROUP_OPTIONS
|
|
705
|
+
? localizeOptions(GROUP_OPTIONS, m.workspace.options.group)
|
|
718
706
|
: menuFlyout === "show"
|
|
719
|
-
? SHOW_FIELD_OPTIONS
|
|
707
|
+
? localizeOptions(SHOW_FIELD_OPTIONS, m.workspace.options.show)
|
|
720
708
|
: menuFlyout === "status"
|
|
721
|
-
? STATUS_FILTER_OPTIONS
|
|
709
|
+
? localizeOptions(STATUS_FILTER_OPTIONS, m.workspace.options.status)
|
|
722
710
|
: menuFlyout === "lifecycle"
|
|
723
|
-
? LIFECYCLE_FILTER_OPTIONS
|
|
711
|
+
? localizeOptions(LIFECYCLE_FILTER_OPTIONS, m.workspace.options.lifecycle)
|
|
724
712
|
: [];
|
|
725
713
|
const flyoutSelectedId: string | undefined =
|
|
726
714
|
menuFlyout === "sort"
|
|
@@ -900,15 +888,11 @@ export function WorkspaceActivityPanel({
|
|
|
900
888
|
showsVerticalScrollIndicator={false}
|
|
901
889
|
showsHorizontalScrollIndicator={false}
|
|
902
890
|
>
|
|
903
|
-
{loading ? <
|
|
904
|
-
{error ?
|
|
905
|
-
<Text style={{ color: theme.colors.statusDanger }}>
|
|
906
|
-
{error instanceof Error ? error.message : String(error)}
|
|
907
|
-
</Text>
|
|
908
|
-
) : null}
|
|
891
|
+
{loading ? <LoadingState color={theme.colors.accent} /> : null}
|
|
892
|
+
{error ? <ErrorState error={error} onRetry={retry} colors={theme.colors} /> : null}
|
|
909
893
|
|
|
910
894
|
{!loading && !error && !showContent ? (
|
|
911
|
-
<
|
|
895
|
+
<InlineEmpty text={m.workspace.empty} color={theme.colors.foregroundMuted} />
|
|
912
896
|
) : null}
|
|
913
897
|
|
|
914
898
|
{!loading && !error && showContent ? (
|
|
@@ -982,6 +966,8 @@ export function WorkspaceActivityPanel({
|
|
|
982
966
|
activeAgentColor={theme.colors.accent}
|
|
983
967
|
archivedAgentColor={theme.colors.foregroundMuted}
|
|
984
968
|
mutedColor={theme.colors.foregroundMuted}
|
|
969
|
+
activeTitleColor={theme.colors.foreground}
|
|
970
|
+
compact={layout.compact}
|
|
985
971
|
styles={styles}
|
|
986
972
|
/>
|
|
987
973
|
) : null}
|
|
@@ -991,7 +977,7 @@ export function WorkspaceActivityPanel({
|
|
|
991
977
|
{menuOpen ? (
|
|
992
978
|
<Pressable
|
|
993
979
|
accessibilityRole="button"
|
|
994
|
-
accessibilityLabel=
|
|
980
|
+
accessibilityLabel={m.workspace.closeDisplayOptions}
|
|
995
981
|
onPress={closeMenu}
|
|
996
982
|
style={styles.menuBackdrop}
|
|
997
983
|
/>
|
|
@@ -1005,23 +991,23 @@ export function WorkspaceActivityPanel({
|
|
|
1005
991
|
<View style={styles.menuSurface}>
|
|
1006
992
|
<View style={styles.menuPage}>
|
|
1007
993
|
<MenuSubTrigger
|
|
1008
|
-
label=
|
|
1009
|
-
value={
|
|
994
|
+
label={m.workspace.menu.sort}
|
|
995
|
+
value={m.workspace.options.sort[agentSort]}
|
|
1010
996
|
active={menuFlyout === "sort"}
|
|
1011
997
|
onOpen={() => setMenuFlyout("sort")}
|
|
1012
998
|
styles={styles}
|
|
1013
999
|
chevronColor={theme.colors.foregroundMuted}
|
|
1014
1000
|
/>
|
|
1015
1001
|
<MenuSubTrigger
|
|
1016
|
-
label=
|
|
1017
|
-
value={
|
|
1002
|
+
label={m.workspace.menu.group}
|
|
1003
|
+
value={m.workspace.options.group[agentGroup]}
|
|
1018
1004
|
active={menuFlyout === "group"}
|
|
1019
1005
|
onOpen={() => setMenuFlyout("group")}
|
|
1020
1006
|
styles={styles}
|
|
1021
1007
|
chevronColor={theme.colors.foregroundMuted}
|
|
1022
1008
|
/>
|
|
1023
1009
|
<MenuSubTrigger
|
|
1024
|
-
label=
|
|
1010
|
+
label={m.workspace.menu.show}
|
|
1025
1011
|
active={menuFlyout === "show"}
|
|
1026
1012
|
onOpen={() => setMenuFlyout("show")}
|
|
1027
1013
|
styles={styles}
|
|
@@ -1029,14 +1015,14 @@ export function WorkspaceActivityPanel({
|
|
|
1029
1015
|
/>
|
|
1030
1016
|
<View style={styles.menuSeparator} />
|
|
1031
1017
|
<MenuSubTrigger
|
|
1032
|
-
label=
|
|
1018
|
+
label={m.workspace.menu.status}
|
|
1033
1019
|
active={menuFlyout === "status"}
|
|
1034
1020
|
onOpen={() => setMenuFlyout("status")}
|
|
1035
1021
|
styles={styles}
|
|
1036
1022
|
chevronColor={theme.colors.foregroundMuted}
|
|
1037
1023
|
/>
|
|
1038
1024
|
<MenuSubTrigger
|
|
1039
|
-
label=
|
|
1025
|
+
label={m.workspace.menu.lifecycle}
|
|
1040
1026
|
active={menuFlyout === "lifecycle"}
|
|
1041
1027
|
onOpen={() => setMenuFlyout("lifecycle")}
|
|
1042
1028
|
styles={styles}
|
|
@@ -10,31 +10,16 @@ import type {
|
|
|
10
10
|
} from "../../shared/usage.ts";
|
|
11
11
|
import { FormattedTime } from "../formatted-time.tsx";
|
|
12
12
|
import { RANK_ROW_ESTIMATE } from "./constants.ts";
|
|
13
|
+
import { ICON_SIZE } from "../design-tokens.ts";
|
|
14
|
+
import { useMessages } from "../use-app-language.ts";
|
|
15
|
+
import { CountText, IconButton, SectionHeader } from "../ui.tsx";
|
|
13
16
|
|
|
14
17
|
type RankKind = "skills" | "mcp";
|
|
15
18
|
export type RankView = "ranked" | "timeline";
|
|
16
19
|
|
|
17
|
-
function rankTitle(kind: RankKind): string {
|
|
18
|
-
return kind === "skills" ? "Skills" : "MCP";
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function rankAction(kind: RankKind): { icon: "Sparkles" | "Plug"; accessibilityLabel: string } {
|
|
22
|
-
return kind === "skills"
|
|
23
|
-
? { icon: "Plug", accessibilityLabel: "Show most used MCP" }
|
|
24
|
-
: { icon: "Sparkles", accessibilityLabel: "Show most used skills" };
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function CountText({
|
|
28
|
-
value,
|
|
29
|
-
styles,
|
|
30
|
-
}: {
|
|
31
|
-
value: number | string;
|
|
32
|
-
styles: { countText: TextStyle };
|
|
33
|
-
}): ReactNode {
|
|
34
|
-
return <Text style={styles.countText}>{value}</Text>;
|
|
35
|
-
}
|
|
36
20
|
|
|
37
21
|
export type RankSectionStyles = {
|
|
22
|
+
section: ViewStyle;
|
|
38
23
|
sectionHeaderRow: ViewStyle;
|
|
39
24
|
sectionTitle: TextStyle;
|
|
40
25
|
titleAction: ViewStyle;
|
|
@@ -67,6 +52,8 @@ export function RankSection({
|
|
|
67
52
|
activeAgentColor,
|
|
68
53
|
archivedAgentColor,
|
|
69
54
|
mutedColor,
|
|
55
|
+
activeTitleColor,
|
|
56
|
+
compact,
|
|
70
57
|
styles,
|
|
71
58
|
}: {
|
|
72
59
|
rankKind: RankKind;
|
|
@@ -83,9 +70,13 @@ export function RankSection({
|
|
|
83
70
|
activeAgentColor: string;
|
|
84
71
|
archivedAgentColor: string;
|
|
85
72
|
mutedColor: string;
|
|
73
|
+
activeTitleColor: string;
|
|
74
|
+
compact: boolean;
|
|
86
75
|
styles: RankSectionStyles;
|
|
87
76
|
}): ReactNode {
|
|
77
|
+
const m = useMessages();
|
|
88
78
|
if (skillItems.length === 0 && mcpItems.length === 0) return null;
|
|
79
|
+
const title = rankKind === "skills" ? m.common.skills : m.common.mcp;
|
|
89
80
|
|
|
90
81
|
const items =
|
|
91
82
|
rankView === "timeline"
|
|
@@ -97,40 +88,23 @@ export function RankSection({
|
|
|
97
88
|
: mcpItems;
|
|
98
89
|
|
|
99
90
|
return (
|
|
100
|
-
<View style={
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
accessibilityLabel={
|
|
118
|
-
rankView === "ranked"
|
|
119
|
-
? `Show ${rankTitle(rankKind)} as a timeline`
|
|
120
|
-
: `Show ${rankTitle(rankKind)} ranked by calls`
|
|
121
|
-
}
|
|
122
|
-
hitSlop={8}
|
|
123
|
-
onPress={onToggleRankView}
|
|
124
|
-
style={styles.titleAction}
|
|
125
|
-
>
|
|
126
|
-
<Icon
|
|
127
|
-
name={rankView === "ranked" ? "GitCommitVertical" : "LayoutList"}
|
|
128
|
-
size={16}
|
|
129
|
-
color={mutedColor}
|
|
130
|
-
/>
|
|
131
|
-
</Pressable>
|
|
132
|
-
</View>
|
|
133
|
-
</View>
|
|
91
|
+
<View style={styles.section}>
|
|
92
|
+
<SectionHeader title={title} colors={{ foreground: activeTitleColor, foregroundMuted: mutedColor }} compact={compact}>
|
|
93
|
+
{showToggle ? (
|
|
94
|
+
<IconButton
|
|
95
|
+
icon={rankKind === "skills" ? "Plug" : "Sparkles"}
|
|
96
|
+
label={rankKind === "skills" ? m.global.rankShow.mcp : m.global.rankShow.skills}
|
|
97
|
+
onPress={onToggleKind}
|
|
98
|
+
color={mutedColor}
|
|
99
|
+
/>
|
|
100
|
+
) : null}
|
|
101
|
+
<IconButton
|
|
102
|
+
icon={rankView === "ranked" ? "GitCommitVertical" : "LayoutList"}
|
|
103
|
+
label={rankView === "ranked" ? m.workspace.showTimeline(title) : m.workspace.showRanked(title)}
|
|
104
|
+
onPress={onToggleRankView}
|
|
105
|
+
color={mutedColor}
|
|
106
|
+
/>
|
|
107
|
+
</SectionHeader>
|
|
134
108
|
<View
|
|
135
109
|
style={[
|
|
136
110
|
styles.panel,
|
|
@@ -147,7 +121,7 @@ export function RankSection({
|
|
|
147
121
|
key={`${item.agentId}:${item.callId}`}
|
|
148
122
|
accessibilityRole={canOpen ? "link" : undefined}
|
|
149
123
|
accessibilityLabel={
|
|
150
|
-
canOpen ?
|
|
124
|
+
canOpen ? m.common.openConversation(item.agentTitle ?? item.agentId) : undefined
|
|
151
125
|
}
|
|
152
126
|
accessibilityState={{ disabled: !canOpen }}
|
|
153
127
|
disabled={!canOpen}
|
|
@@ -190,7 +164,7 @@ export function RankSection({
|
|
|
190
164
|
key={`${item.agentId}:${item.callId}`}
|
|
191
165
|
accessibilityRole={canOpen ? "link" : undefined}
|
|
192
166
|
accessibilityLabel={
|
|
193
|
-
canOpen ?
|
|
167
|
+
canOpen ? m.common.openConversation(item.agentTitle ?? item.agentId) : undefined
|
|
194
168
|
}
|
|
195
169
|
accessibilityState={{ disabled: !canOpen }}
|
|
196
170
|
disabled={!canOpen}
|
|
@@ -228,40 +202,40 @@ export function RankSection({
|
|
|
228
202
|
: rankKind === "skills"
|
|
229
203
|
? skillItems.map((item) => (
|
|
230
204
|
<View key={item.skillName} style={styles.listRow}>
|
|
231
|
-
<Icon name="Sparkles" size={
|
|
205
|
+
<Icon name="Sparkles" size={ICON_SIZE.leading} color={mutedColor} />
|
|
232
206
|
<View style={styles.listMain}>
|
|
233
207
|
<Text style={styles.listTitle} numberOfLines={1}>
|
|
234
208
|
{formatDisplayName(item.skillName)}
|
|
235
209
|
</Text>
|
|
236
210
|
<FormattedTime
|
|
237
211
|
iso={item.lastUsedAt}
|
|
238
|
-
|
|
212
|
+
format={m.common.lastUsed}
|
|
239
213
|
style={styles.listMeta}
|
|
240
214
|
/>
|
|
241
215
|
</View>
|
|
242
|
-
<CountText value={item.total}
|
|
216
|
+
<CountText value={item.total} color={mutedColor} />
|
|
243
217
|
</View>
|
|
244
218
|
))
|
|
245
219
|
: mcpItems.map((item) => (
|
|
246
220
|
<View key={`${item.server}.${item.tool}`} style={styles.listRow}>
|
|
247
|
-
<Icon name="Plug" size={
|
|
221
|
+
<Icon name="Plug" size={ICON_SIZE.leading} color={mutedColor} />
|
|
248
222
|
<View style={styles.listMain}>
|
|
249
223
|
<Text style={styles.listTitle} numberOfLines={1}>
|
|
250
224
|
{formatDisplayName(`${item.server}.${item.tool}`)}
|
|
251
225
|
</Text>
|
|
252
226
|
{item.failures > 0 ? (
|
|
253
|
-
<Text style={styles.listMeta}>{item.failures}
|
|
227
|
+
<Text style={styles.listMeta}>{m.common.failed(item.failures)}</Text>
|
|
254
228
|
) : item.lastUsedAt ? (
|
|
255
229
|
<FormattedTime
|
|
256
230
|
iso={item.lastUsedAt}
|
|
257
|
-
|
|
231
|
+
format={m.common.lastUsed}
|
|
258
232
|
style={styles.listMeta}
|
|
259
233
|
/>
|
|
260
234
|
) : (
|
|
261
235
|
<Text style={styles.listMeta}>—</Text>
|
|
262
236
|
)}
|
|
263
237
|
</View>
|
|
264
|
-
<CountText value={item.count}
|
|
238
|
+
<CountText value={item.count} color={mutedColor} />
|
|
265
239
|
</View>
|
|
266
240
|
))}
|
|
267
241
|
</View>
|