@koinzhang/paseo-plugin-activity 0.5.0 → 0.6.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.
@@ -30,6 +30,8 @@ import {
30
30
  usageAgentsRpc,
31
31
  usageHostInfoRpc,
32
32
  usageMcpByToolRpc,
33
+ usageRecentMcpCallsRpc,
34
+ usageRecentSkillCallsRpc,
33
35
  usageSkillsByNameRpc,
34
36
  usageSummaryRpc,
35
37
  } from "../../shared/usage.ts";
@@ -94,6 +96,7 @@ export function WorkspaceActivityPanel({
94
96
  () => new Set(displayValues.lifecycle),
95
97
  [displayValues.lifecycle],
96
98
  );
99
+ const rankView = displayValues.rankView;
97
100
  const [menuOpen, setMenuOpen] = useState(false);
98
101
  const [menuFlyout, setMenuFlyout] = useState<MenuFlyout | null>(null);
99
102
  const [menuAnchor, setMenuAnchor] = useState<{ top: number; right: number } | null>(null);
@@ -119,7 +122,9 @@ export function WorkspaceActivityPanel({
119
122
  const agentsRpc = useRpc(usageAgentsRpc);
120
123
  const unarchiveAgentRpc = useRpc(usageAgentUnarchiveRpc);
121
124
  const skillsRpc = useRpc(usageSkillsByNameRpc);
125
+ const recentSkillCallsRpc = useRpc(usageRecentSkillCallsRpc);
122
126
  const mcpRpc = useRpc(usageMcpByToolRpc);
127
+ const recentMcpCallsRpc = useRpc(usageRecentMcpCallsRpc);
123
128
  const hostInfoRpc = useRpc(usageHostInfoRpc);
124
129
 
125
130
  const agentsQueryKey = useMemo(
@@ -152,6 +157,13 @@ export function WorkspaceActivityPanel({
152
157
  queryFn: () => skillsRpc({ workspaceId }),
153
158
  });
154
159
 
160
+ const recentSkillCalls = useQuery({
161
+ refetchInterval: 15_000,
162
+ retry: false,
163
+ queryKey: ["activity", "workspace-recent-skills", workspaceId],
164
+ queryFn: () => recentSkillCallsRpc({ workspaceId, limit: ACTIVITY_LIST_LIMIT }),
165
+ });
166
+
155
167
  const mcp = useQuery({
156
168
  refetchInterval: 15_000,
157
169
  retry: false,
@@ -159,6 +171,13 @@ export function WorkspaceActivityPanel({
159
171
  queryFn: () => mcpRpc({ workspaceId }),
160
172
  });
161
173
 
174
+ const recentMcpCalls = useQuery({
175
+ refetchInterval: 15_000,
176
+ retry: false,
177
+ queryKey: ["activity", "workspace-recent-mcp", workspaceId],
178
+ queryFn: () => recentMcpCallsRpc({ workspaceId, limit: ACTIVITY_LIST_LIMIT }),
179
+ });
180
+
162
181
  const paseo = usePaseo();
163
182
  const terminals = useQuery({
164
183
  refetchInterval: TERMINAL_REFETCH_MS,
@@ -184,15 +203,30 @@ export function WorkspaceActivityPanel({
184
203
  void queryClient.invalidateQueries({
185
204
  queryKey: ["activity", "workspace-skills", workspaceId],
186
205
  });
206
+ void queryClient.invalidateQueries({
207
+ queryKey: ["activity", "workspace-recent-skills", workspaceId],
208
+ });
187
209
  void queryClient.invalidateQueries({
188
210
  queryKey: ["activity", "workspace-mcp", workspaceId],
189
211
  });
212
+ void queryClient.invalidateQueries({
213
+ queryKey: ["activity", "workspace-recent-mcp", workspaceId],
214
+ });
190
215
  });
191
216
 
192
217
  const agentItems = useMemo(
193
218
  () => reconcileHostArchive(agents.data?.items ?? [], statuses.data),
194
219
  [agents.data, statuses.data],
195
220
  );
221
+ const archivedAgentIds = useMemo(
222
+ () =>
223
+ new Set(
224
+ agentItems
225
+ .filter((item) => item.archivedAt != null)
226
+ .map((item) => item.agentId),
227
+ ),
228
+ [agentItems],
229
+ );
196
230
  const visibleAgentItems = useMemo(() => {
197
231
  const byId = statuses.data;
198
232
  const filtered = agentItems
@@ -243,11 +277,24 @@ export function WorkspaceActivityPanel({
243
277
  [mcp.data],
244
278
  );
245
279
  const skillItems = useMemo(() => allSkills.slice(0, ACTIVITY_LIST_LIMIT), [allSkills]);
280
+ const recentSkillItems = recentSkillCalls.data?.items ?? [];
246
281
  const mcpItems = useMemo(() => allMcp.slice(0, ACTIVITY_LIST_LIMIT), [allMcp]);
282
+ const recentMcpItems = recentMcpCalls.data?.items ?? [];
247
283
 
248
284
  const loading =
249
- summary.isLoading || agents.isLoading || skills.isLoading || mcp.isLoading;
250
- const error = summary.error ?? agents.error ?? skills.error ?? mcp.error;
285
+ summary.isLoading ||
286
+ agents.isLoading ||
287
+ skills.isLoading ||
288
+ recentSkillCalls.isLoading ||
289
+ mcp.isLoading ||
290
+ recentMcpCalls.isLoading;
291
+ const error =
292
+ summary.error ??
293
+ agents.error ??
294
+ skills.error ??
295
+ recentSkillCalls.error ??
296
+ mcp.error ??
297
+ recentMcpCalls.error;
251
298
 
252
299
  const kpi = [
253
300
  { label: "Shell calls", value: (summary.data?.shellCalls ?? 0).toLocaleString() },
@@ -375,6 +422,32 @@ export function WorkspaceActivityPanel({
375
422
  gap: 12,
376
423
  paddingVertical: 6,
377
424
  },
425
+ timelineMarker: {
426
+ width: 18,
427
+ alignSelf: "stretch" as const,
428
+ alignItems: "center" as const,
429
+ justifyContent: "center" as const,
430
+ },
431
+ timelineLineTop: {
432
+ position: "absolute" as const,
433
+ top: -7,
434
+ bottom: "50%" as const,
435
+ width: 1,
436
+ backgroundColor: theme.colors.border,
437
+ },
438
+ timelineLineBottom: {
439
+ position: "absolute" as const,
440
+ top: "50%" as const,
441
+ bottom: -7,
442
+ width: 1,
443
+ backgroundColor: theme.colors.border,
444
+ },
445
+ timelineDot: {
446
+ zIndex: 1,
447
+ width: 7,
448
+ height: 7,
449
+ borderRadius: 3.5,
450
+ },
378
451
  agentListRow: {
379
452
  flexDirection: "row" as const,
380
453
  alignItems: "center" as const,
@@ -892,9 +965,22 @@ export function WorkspaceActivityPanel({
892
965
  onToggleKind={() =>
893
966
  setRankKind((prev) => (prev === "skills" ? "mcp" : "skills"))
894
967
  }
968
+ rankView={rankView}
969
+ onToggleRankView={() =>
970
+ persistDisplay({
971
+ ...displayValues,
972
+ rankView: rankView === "ranked" ? "timeline" : "ranked",
973
+ })
974
+ }
895
975
  showToggle={showRankToggle}
896
976
  skillItems={skillItems}
977
+ recentSkillCalls={recentSkillItems}
897
978
  mcpItems={mcpItems}
979
+ recentMcpCalls={recentMcpItems}
980
+ archivedAgentIds={archivedAgentIds}
981
+ openAgent={openAgent}
982
+ activeAgentColor={theme.colors.accent}
983
+ archivedAgentColor={theme.colors.foregroundMuted}
898
984
  mutedColor={theme.colors.foregroundMuted}
899
985
  styles={styles}
900
986
  />
@@ -2,11 +2,17 @@ import { Icon } from "@getpaseo/plugin/client/react-native";
2
2
  import type { ReactNode } from "react";
3
3
  import { Pressable, Text, View, type TextStyle, type ViewStyle } from "react-native";
4
4
  import { formatDisplayName } from "../../shared/format.ts";
5
- import type { McpByToolItem, SkillByNameItem } from "../../shared/usage.ts";
5
+ import type {
6
+ McpByToolItem,
7
+ RecentMcpCallItem,
8
+ RecentSkillCallItem,
9
+ SkillByNameItem,
10
+ } from "../../shared/usage.ts";
6
11
  import { FormattedTime } from "../formatted-time.tsx";
7
12
  import { RANK_ROW_ESTIMATE } from "./constants.ts";
8
13
 
9
14
  type RankKind = "skills" | "mcp";
15
+ export type RankView = "ranked" | "timeline";
10
16
 
11
17
  function rankTitle(kind: RankKind): string {
12
18
  return kind === "skills" ? "Skills" : "MCP";
@@ -32,8 +38,13 @@ export type RankSectionStyles = {
32
38
  sectionHeaderRow: ViewStyle;
33
39
  sectionTitle: TextStyle;
34
40
  titleAction: ViewStyle;
41
+ headerActions: ViewStyle;
35
42
  panel: ViewStyle;
36
43
  listRow: ViewStyle;
44
+ timelineMarker: ViewStyle;
45
+ timelineLineTop: ViewStyle;
46
+ timelineLineBottom: ViewStyle;
47
+ timelineDot: ViewStyle;
37
48
  listMain: ViewStyle;
38
49
  listTitle: TextStyle;
39
50
  listMeta: TextStyle;
@@ -44,39 +55,81 @@ export type RankSectionStyles = {
44
55
  export function RankSection({
45
56
  rankKind,
46
57
  onToggleKind,
58
+ rankView,
59
+ onToggleRankView,
47
60
  showToggle = true,
48
61
  skillItems,
62
+ recentSkillCalls,
49
63
  mcpItems,
64
+ recentMcpCalls,
65
+ archivedAgentIds,
66
+ openAgent,
67
+ activeAgentColor,
68
+ archivedAgentColor,
50
69
  mutedColor,
51
70
  styles,
52
71
  }: {
53
72
  rankKind: RankKind;
54
73
  onToggleKind: () => void;
74
+ rankView: RankView;
75
+ onToggleRankView: () => void;
55
76
  showToggle?: boolean;
56
77
  skillItems: ReadonlyArray<SkillByNameItem>;
78
+ recentSkillCalls: ReadonlyArray<RecentSkillCallItem>;
57
79
  mcpItems: ReadonlyArray<McpByToolItem>;
80
+ recentMcpCalls: ReadonlyArray<RecentMcpCallItem>;
81
+ archivedAgentIds: ReadonlySet<string>;
82
+ openAgent?: (input: { agentId: string }) => void;
83
+ activeAgentColor: string;
84
+ archivedAgentColor: string;
58
85
  mutedColor: string;
59
86
  styles: RankSectionStyles;
60
87
  }): ReactNode {
61
88
  if (skillItems.length === 0 && mcpItems.length === 0) return null;
62
89
 
63
- const items = rankKind === "skills" ? skillItems : mcpItems;
90
+ const items =
91
+ rankView === "timeline"
92
+ ? rankKind === "skills"
93
+ ? recentSkillCalls
94
+ : recentMcpCalls
95
+ : rankKind === "skills"
96
+ ? skillItems
97
+ : mcpItems;
64
98
 
65
99
  return (
66
100
  <View style={{ gap: 12 }}>
67
101
  <View style={styles.sectionHeaderRow}>
68
102
  <Text style={styles.sectionTitle}>{rankTitle(rankKind)}</Text>
69
- {showToggle ? (
103
+ <View style={styles.headerActions}>
104
+ {showToggle ? (
105
+ <Pressable
106
+ accessibilityRole="button"
107
+ accessibilityLabel={rankAction(rankKind).accessibilityLabel}
108
+ hitSlop={8}
109
+ onPress={onToggleKind}
110
+ style={styles.titleAction}
111
+ >
112
+ <Icon name={rankAction(rankKind).icon} size={16} color={mutedColor} />
113
+ </Pressable>
114
+ ) : null}
70
115
  <Pressable
71
116
  accessibilityRole="button"
72
- accessibilityLabel={rankAction(rankKind).accessibilityLabel}
117
+ accessibilityLabel={
118
+ rankView === "ranked"
119
+ ? `Show ${rankTitle(rankKind)} as a timeline`
120
+ : `Show ${rankTitle(rankKind)} ranked by calls`
121
+ }
73
122
  hitSlop={8}
74
- onPress={onToggleKind}
123
+ onPress={onToggleRankView}
75
124
  style={styles.titleAction}
76
125
  >
77
- <Icon name={rankAction(rankKind).icon} size={16} color={mutedColor} />
126
+ <Icon
127
+ name={rankView === "ranked" ? "GitCommitVertical" : "LayoutList"}
128
+ size={16}
129
+ color={mutedColor}
130
+ />
78
131
  </Pressable>
79
- ) : null}
132
+ </View>
80
133
  </View>
81
134
  <View
82
135
  style={[
@@ -86,8 +139,94 @@ export function RankSection({
86
139
  },
87
140
  ]}
88
141
  >
89
- {rankKind === "skills"
90
- ? skillItems.map((item) => (
142
+ {rankKind === "skills" && rankView === "timeline"
143
+ ? recentSkillCalls.map((item, index) => {
144
+ const canOpen = openAgent != null && !archivedAgentIds.has(item.agentId);
145
+ return (
146
+ <Pressable
147
+ key={`${item.agentId}:${item.callId}`}
148
+ accessibilityRole={canOpen ? "link" : undefined}
149
+ accessibilityLabel={
150
+ canOpen ? `Open conversation ${item.agentTitle ?? item.agentId}` : undefined
151
+ }
152
+ accessibilityState={{ disabled: !canOpen }}
153
+ disabled={!canOpen}
154
+ onPress={canOpen ? () => openAgent({ agentId: item.agentId }) : undefined}
155
+ style={styles.listRow}
156
+ >
157
+ <View style={styles.timelineMarker}>
158
+ {index > 0 ? <View style={styles.timelineLineTop} /> : null}
159
+ <View
160
+ style={[
161
+ styles.timelineDot,
162
+ {
163
+ backgroundColor: archivedAgentIds.has(item.agentId)
164
+ ? archivedAgentColor
165
+ : activeAgentColor,
166
+ },
167
+ ]}
168
+ />
169
+ {index < recentSkillCalls.length - 1 ? (
170
+ <View style={styles.timelineLineBottom} />
171
+ ) : null}
172
+ </View>
173
+ <View style={styles.listMain}>
174
+ <Text style={styles.listTitle} numberOfLines={1}>
175
+ {formatDisplayName(item.skillName)}
176
+ </Text>
177
+ <Text style={styles.listMeta} numberOfLines={1}>
178
+ {item.agentTitle ?? item.agentId}
179
+ </Text>
180
+ </View>
181
+ <FormattedTime iso={item.calledAt} style={styles.listMeta} />
182
+ </Pressable>
183
+ );
184
+ })
185
+ : rankKind === "mcp" && rankView === "timeline"
186
+ ? recentMcpCalls.map((item, index) => {
187
+ const canOpen = openAgent != null && !archivedAgentIds.has(item.agentId);
188
+ return (
189
+ <Pressable
190
+ key={`${item.agentId}:${item.callId}`}
191
+ accessibilityRole={canOpen ? "link" : undefined}
192
+ accessibilityLabel={
193
+ canOpen ? `Open conversation ${item.agentTitle ?? item.agentId}` : undefined
194
+ }
195
+ accessibilityState={{ disabled: !canOpen }}
196
+ disabled={!canOpen}
197
+ onPress={canOpen ? () => openAgent({ agentId: item.agentId }) : undefined}
198
+ style={styles.listRow}
199
+ >
200
+ <View style={styles.timelineMarker}>
201
+ {index > 0 ? <View style={styles.timelineLineTop} /> : null}
202
+ <View
203
+ style={[
204
+ styles.timelineDot,
205
+ {
206
+ backgroundColor: archivedAgentIds.has(item.agentId)
207
+ ? archivedAgentColor
208
+ : activeAgentColor,
209
+ },
210
+ ]}
211
+ />
212
+ {index < recentMcpCalls.length - 1 ? (
213
+ <View style={styles.timelineLineBottom} />
214
+ ) : null}
215
+ </View>
216
+ <View style={styles.listMain}>
217
+ <Text style={styles.listTitle} numberOfLines={1}>
218
+ {formatDisplayName(`${item.server}.${item.tool}`)}
219
+ </Text>
220
+ <Text style={styles.listMeta} numberOfLines={1}>
221
+ {item.agentTitle ?? item.agentId}
222
+ </Text>
223
+ </View>
224
+ <FormattedTime iso={item.calledAt} style={styles.listMeta} />
225
+ </Pressable>
226
+ );
227
+ })
228
+ : rankKind === "skills"
229
+ ? skillItems.map((item) => (
91
230
  <View key={item.skillName} style={styles.listRow}>
92
231
  <Icon name="Sparkles" size={18} color={mutedColor} />
93
232
  <View style={styles.listMain}>
@@ -102,8 +241,8 @@ export function RankSection({
102
241
  </View>
103
242
  <CountText value={item.total} styles={styles} />
104
243
  </View>
105
- ))
106
- : mcpItems.map((item) => (
244
+ ))
245
+ : mcpItems.map((item) => (
107
246
  <View key={`${item.server}.${item.tool}`} style={styles.listRow}>
108
247
  <Icon name="Plug" size={18} color={mutedColor} />
109
248
  <View style={styles.listMain}>
package/index.server.ts CHANGED
@@ -2,13 +2,18 @@ import { createBackgroundSync } from "./server/background-sync.ts";
2
2
  import { homedir } from "node:os";
3
3
  import type { PluginServerContext } from "@getpaseo/plugin/server";
4
4
  import {
5
+ createActivityByHourHandler,
5
6
  createActivityByDayHandler,
7
+ createAgentCreationsHandler,
8
+ createAgentLifetimeHandler,
6
9
  createAgentsHandler,
7
10
  createByProviderHandler,
8
11
  createExportHandler,
9
12
  createListHandler,
10
13
  createMcpByToolHandler,
11
14
  createReadSkillHandler,
15
+ createRecentMcpCallsHandler,
16
+ createRecentSkillCallsHandler,
12
17
  createSkillsByNameHandler,
13
18
  createSummaryHandler,
14
19
  createUnarchiveAgentHandler,
@@ -18,7 +23,10 @@ import { ingestTimeline, ingestUserMessages } from "./server/ingest.ts";
18
23
  import { resolveAgentModel } from "./server/resolve-model.ts";
19
24
  import { createUsageStore } from "./server/store.ts";
20
25
  import {
26
+ usageActivityByHourRpc,
21
27
  usageActivityByDayRpc,
28
+ usageAgentCreationsRpc,
29
+ usageAgentLifetimeRpc,
22
30
  usageAgentsRpc,
23
31
  usageAgentUnarchiveRpc,
24
32
  usageByProviderRpc,
@@ -27,6 +35,8 @@ import {
27
35
  usageListRpc,
28
36
  usageMcpByToolRpc,
29
37
  usageReadSkillRpc,
38
+ usageRecentMcpCallsRpc,
39
+ usageRecentSkillCallsRpc,
30
40
  usageSkillsByNameRpc,
31
41
  usageSummaryRpc,
32
42
  } from "./shared/usage.ts";
@@ -50,6 +60,14 @@ export default function contribute(server: PluginServerContext) {
50
60
  void background.request(context.paseo);
51
61
  return createSkillsByNameHandler(store)(input, context);
52
62
  });
63
+ server.handle(usageRecentSkillCallsRpc, (input, context) => {
64
+ void background.request(context.paseo);
65
+ return createRecentSkillCallsHandler(store)(input);
66
+ });
67
+ server.handle(usageRecentMcpCallsRpc, (input, context) => {
68
+ void background.request(context.paseo);
69
+ return createRecentMcpCallsHandler(store)(input);
70
+ });
53
71
  server.handle(usageMcpByToolRpc, (input, context) => {
54
72
  void background.request(context.paseo);
55
73
  return createMcpByToolHandler(store)(input);
@@ -67,6 +85,18 @@ export default function contribute(server: PluginServerContext) {
67
85
  void background.request(context.paseo);
68
86
  return createActivityByDayHandler(store)(input);
69
87
  });
88
+ server.handle(usageActivityByHourRpc, (input, context) => {
89
+ void background.request(context.paseo);
90
+ return createActivityByHourHandler(store)(input);
91
+ });
92
+ server.handle(usageAgentLifetimeRpc, (input, context) => {
93
+ void background.request(context.paseo);
94
+ return createAgentLifetimeHandler(store)(input);
95
+ });
96
+ server.handle(usageAgentCreationsRpc, (input, context) => {
97
+ void background.request(context.paseo);
98
+ return createAgentCreationsHandler(store)(input);
99
+ });
70
100
  server.handle(usageExportRpc, createExportHandler(store));
71
101
  server.handle(usageHostInfoRpc, () => ({ homeDir: homedir() }));
72
102
  server.handle(usageReadSkillRpc, createReadSkillHandler());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koinzhang/paseo-plugin-activity",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Local usage analytics and workspace agent ops for Paseo: tools, agents, messages, models, Explorer fleet list, and terminals.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  ],
23
23
  "scripts": {
24
24
  "typecheck": "tsc --noEmit",
25
- "test": "node --experimental-strip-types --test server/background-sync.test.ts server/handlers-query.test.ts client/attention-agents.test.ts client/latest-user-message.test.ts client/pill-data-cache.test.ts client/hidden-pill-recheck.test.ts client/workspace/list-host-agents.test.ts client/agent-directory.test.ts client/workspace/constants.test.ts client/workspace/filters.test.ts client/workspace/host-archive-sync.test.ts client/rank-color.test.ts client/provider-filter.test.ts client/workspace/terminal-preview.test.ts shared/activity.test.ts shared/insights.test.ts shared/classify.test.ts shared/usage.test.ts shared/format.test.ts shared/agent-title-search.test.ts shared/list-agent-pages.test.ts shared/agent-page-size.test.ts server/store.test.ts server/ingest.test.ts server/skill-path.test.ts server/mcp-servers.test.ts server/agents.test.ts server/migrate-data.test.ts server/messages.test.ts server/resolve-model.test.ts"
25
+ "test": "node --experimental-strip-types --test server/background-sync.test.ts server/handlers-query.test.ts client/attention-agents.test.ts client/latest-user-message.test.ts client/pill-data-cache.test.ts client/hidden-pill-recheck.test.ts client/agent-directory.test.ts client/workspace/list-host-agents.test.ts client/workspace/constants.test.ts client/workspace/filters.test.ts client/workspace/host-archive-sync.test.ts client/rank-color.test.ts client/color-mix.test.ts client/fit-text.test.ts client/provider-filter.test.ts client/workspace/terminal-preview.test.ts shared/activity.test.ts shared/insights.test.ts shared/classify.test.ts shared/usage.test.ts shared/format.test.ts shared/explorer-agent-display.test.ts shared/agent-title-search.test.ts shared/list-agent-pages.test.ts shared/agent-page-size.test.ts server/store.test.ts server/ingest.test.ts server/skill-path.test.ts server/mcp-servers.test.ts server/agents.test.ts server/migrate-data.test.ts server/messages.test.ts server/resolve-model.test.ts"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@getpaseo/plugin": "0.9.0-beta.2",
@@ -152,3 +152,46 @@ test("stopping after agents.list prevents directory writes", async () => {
152
152
  f.cleanup();
153
153
  }
154
154
  });
155
+
156
+ test("archived agents are registered but never scanned", async () => {
157
+ const f = fixture();
158
+ const archived = {
159
+ id: "archived-1",
160
+ provider: "codex",
161
+ createdAt: "2026-09-07T03:34:09.656Z",
162
+ updatedAt: "2026-09-07T03:34:09.656Z",
163
+ lastUserMessageAt: null,
164
+ archivedAt: "2026-09-18T17:18:18.001Z",
165
+ };
166
+ const listOptions: Array<Record<string, unknown>> = [];
167
+ const paseo = {
168
+ agents: {
169
+ list: async (options: Record<string, unknown>) => {
170
+ listOptions.push(options);
171
+ return {
172
+ entries: [{ agent: f.agent }, { agent: archived }],
173
+ pageInfo: { hasMore: false, nextCursor: null, prevCursor: null },
174
+ };
175
+ },
176
+ },
177
+ } as unknown as PaseoApi;
178
+ let scans = 0;
179
+ const sync = createBackgroundSync(f.store, {
180
+ path: f.path,
181
+ scan: async () => {
182
+ scans++;
183
+ return { syncedAgents: 1, inserted: 0, errors: [] };
184
+ },
185
+ });
186
+ try {
187
+ await sync.request(paseo);
188
+ assert.equal(scans, 1);
189
+ assert.deepEqual(listOptions[0]?.filter, { includeArchived: true });
190
+ const row = f.store.getAgent("archived-1");
191
+ assert.equal(row?.createdAt, "2026-09-07T03:34:09.656Z");
192
+ assert.equal(row?.archivedAt, "2026-09-18T17:18:18.001Z");
193
+ } finally {
194
+ sync.stop();
195
+ f.cleanup();
196
+ }
197
+ });
@@ -18,6 +18,9 @@ const AGENT_LIST_PAGE_LIMIT = 200;
18
18
  async function listAllAgents(paseo: PaseoApi) {
19
19
  return listAllAgentPages(async (cursor) => {
20
20
  const result = await paseo.agents.list({
21
+ // Archived agents only appear with this filter (049): without it their
22
+ // createdAt / archivedAt never reach the local registry.
23
+ filter: { includeArchived: true },
21
24
  page: { limit: AGENT_LIST_PAGE_LIMIT, ...(cursor ? { cursor } : {}) },
22
25
  });
23
26
  return { entries: result.entries, pageInfo: result.pageInfo };
@@ -62,6 +65,9 @@ export function createBackgroundSync(store: UsageStore, options: {
62
65
  store.upsertAgents(listedEntries.map(({ agent }) => agentRowFromSnapshot(agent)));
63
66
  const known = new Set(store.selectAgents().map(agent => agent.agentId));
64
67
  store.upsertAgents(agentsFromToolCalls(store.select()).filter(agent => !known.has(agent.agentId)));
68
+ console.log(
69
+ `${LOG_PREFIX} directory sync listed=${listedEntries.length} (archived=${listedEntries.filter(entry => entry.agent.archivedAt).length}) registry=${known.size}`,
70
+ );
65
71
 
66
72
  const liveIds = new Set(listedEntries.map(({ agent }) => agent.id));
67
73
  const pruned: Record<string, string> = Object.create(null);
@@ -74,6 +80,9 @@ export function createBackgroundSync(store: UsageStore, options: {
74
80
 
75
81
  for (const { agent } of listedEntries) {
76
82
  if (controller.signal.aborted) return;
83
+ // Archived agents contribute registry metadata only: their timeline is
84
+ // frozen and a full scan per agent would dwarf the 5-minute budget.
85
+ if (agent.archivedAt) continue;
77
86
  const stamp = `${agent.updatedAt}:${agent.lastUserMessageAt ?? ""}`;
78
87
  if (checkpoints[agent.id] === stamp) continue;
79
88
  const result = await scan(store, paseo, [agent.id], controller.signal, listedEntries);