@koinzhang/paseo-plugin-activity 0.7.0 → 0.8.1
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 +33 -2
- package/README.md +6 -6
- package/client/activity-heatmap.tsx +1 -1
- package/client/agent-creations.tsx +4 -3
- package/client/attention-pill.tsx +1 -1
- package/client/design-tokens.ts +14 -2
- package/client/global-surface.tsx +12 -5
- package/client/hourly-activity-timeline.tsx +27 -10
- package/client/panel.tsx +11 -3
- package/client/pill.tsx +1 -1
- package/client/provider-dropdown.tsx +6 -3
- package/client/ranking-bars.tsx +8 -5
- package/client/sidebar-item.tsx +15 -0
- package/client/ui.tsx +17 -5
- package/client/usage-popover.tsx +10 -3
- package/client/workspace/agent-row.tsx +11 -4
- package/client/workspace/agents-section.tsx +32 -50
- package/client/workspace/constants.ts +2 -0
- package/client/workspace/display-menu.tsx +1 -1
- package/client/workspace/panel.tsx +7 -1
- package/client/workspace/rank-section.tsx +4 -3
- package/client/workspace/running-indicator-motion.ts +3 -0
- package/client/workspace/running-indicator.test.ts +15 -0
- package/client/workspace/running-indicator.tsx +3 -2
- package/client/workspace/terminals-section.tsx +12 -4
- package/index.client.tsx +13 -11
- package/index.server.ts +20 -38
- package/package.json +3 -3
- package/paseo-plugin.json +1 -1
- package/server/agents.test.ts +2 -0
- package/server/handlers.ts +6 -0
- package/server/host-types.ts +8 -7
- package/server/ingest.test.ts +2 -0
- package/server/messages.test.ts +1 -1
- package/server/turn-ingest.test.ts +303 -0
- package/server/turn-ingest.ts +75 -0
- package/shared/insights.ts +1 -1
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { test } from "node:test";
|
|
6
|
+
import type { PluginHookAgent, PluginHookContext } from "@getpaseo/plugin/server";
|
|
7
|
+
import type { AgentTimelineItem } from "./host-types.ts";
|
|
8
|
+
import { createUsageStore } from "./store.ts";
|
|
9
|
+
import { ingestTurnAfter, refetchTurnTimeline } from "./turn-ingest.ts";
|
|
10
|
+
|
|
11
|
+
const agent: PluginHookAgent = {
|
|
12
|
+
id: "agent-1",
|
|
13
|
+
workspaceId: "ws-1",
|
|
14
|
+
parentAgentId: null,
|
|
15
|
+
provider: "claude",
|
|
16
|
+
cwd: "/repo",
|
|
17
|
+
title: "turn ingest agent",
|
|
18
|
+
background: false,
|
|
19
|
+
metadata: {},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const TURN_ID = "turn-1";
|
|
23
|
+
type ToolCallItem = Extract<AgentTimelineItem, { type: "tool_call" }>;
|
|
24
|
+
type TimelineEntry = { item: AgentTimelineItem; turnId?: string | null };
|
|
25
|
+
type RefetchOptions = {
|
|
26
|
+
direction?: string;
|
|
27
|
+
limit?: number;
|
|
28
|
+
wholeTurns?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
function fakePaseo(
|
|
32
|
+
entries: TimelineEntry[],
|
|
33
|
+
options: {
|
|
34
|
+
error?: string;
|
|
35
|
+
model?: string | null;
|
|
36
|
+
refreshedModel?: string;
|
|
37
|
+
beforeRefresh?: () => void;
|
|
38
|
+
beforeRefetch?: () => void;
|
|
39
|
+
} = {},
|
|
40
|
+
) {
|
|
41
|
+
const requests: RefetchOptions[] = [];
|
|
42
|
+
const refetch = async (input: RefetchOptions) => {
|
|
43
|
+
requests.push(input);
|
|
44
|
+
options.beforeRefetch?.();
|
|
45
|
+
return { entries, error: options.error ?? null };
|
|
46
|
+
};
|
|
47
|
+
let snapshot = options.model ? { model: options.model } : null;
|
|
48
|
+
const paseo = {
|
|
49
|
+
agents: {
|
|
50
|
+
ref: () => ({
|
|
51
|
+
current: () => snapshot,
|
|
52
|
+
refresh: async () => {
|
|
53
|
+
options.beforeRefresh?.();
|
|
54
|
+
if (options.refreshedModel) snapshot = { model: options.refreshedModel };
|
|
55
|
+
return snapshot;
|
|
56
|
+
},
|
|
57
|
+
timeline: { refetch },
|
|
58
|
+
}),
|
|
59
|
+
},
|
|
60
|
+
} as unknown as PluginHookContext["paseo"];
|
|
61
|
+
return { paseo, requests };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function turnEntries(items: AgentTimelineItem[], turnId: string = TURN_ID): TimelineEntry[] {
|
|
65
|
+
return items.map((item) => ({ item, turnId }));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function withStore(run: (store: ReturnType<typeof createUsageStore>) => Promise<void>) {
|
|
69
|
+
return async () => {
|
|
70
|
+
const dir = mkdtempSync(join(tmpdir(), "activity-turn-ingest-"));
|
|
71
|
+
const store = createUsageStore({ dir, driver: "jsonl" });
|
|
72
|
+
try {
|
|
73
|
+
await run(store);
|
|
74
|
+
} finally {
|
|
75
|
+
store.close();
|
|
76
|
+
rmSync(dir, { recursive: true, force: true });
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function toolCall(callId: string, name: string, detail: ToolCallItem["detail"]): ToolCallItem {
|
|
82
|
+
return { type: "tool_call", callId, name, detail, status: "completed", error: null };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const prompt: AgentTimelineItem = { type: "user_message", messageId: "m-1", text: "hi" };
|
|
86
|
+
const skillCall = toolCall("call-1", "Skill", { type: "plain_text", label: "paseo-plugin" });
|
|
87
|
+
const shellCall = toolCall("call-2", "Bash", { type: "shell", command: "git status", exitCode: 0 });
|
|
88
|
+
|
|
89
|
+
test("refetchTurnTimeline requests the latest complete turn", async () => {
|
|
90
|
+
const { paseo, requests } = fakePaseo(turnEntries([prompt]));
|
|
91
|
+
|
|
92
|
+
assert.deepEqual(await refetchTurnTimeline(paseo, agent.id, TURN_ID), [prompt]);
|
|
93
|
+
assert.deepEqual(requests, [{ direction: "tail", limit: 1, wholeTurns: true }]);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test("refetchTurnTimeline surfaces daemon errors", async () => {
|
|
97
|
+
const { paseo } = fakePaseo([], { error: "timeline unavailable" });
|
|
98
|
+
|
|
99
|
+
await assert.rejects(() => refetchTurnTimeline(paseo, agent.id, TURN_ID), /timeline unavailable/);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test("refetchTurnTimeline excludes earlier, later, missing and null turn ids", async () => {
|
|
103
|
+
const { paseo } = fakePaseo([
|
|
104
|
+
{ item: prompt, turnId: "older" },
|
|
105
|
+
{ item: shellCall, turnId: TURN_ID },
|
|
106
|
+
{ item: skillCall, turnId: "newer" },
|
|
107
|
+
{ item: prompt },
|
|
108
|
+
{ item: prompt, turnId: null },
|
|
109
|
+
]);
|
|
110
|
+
|
|
111
|
+
assert.deepEqual(await refetchTurnTimeline(paseo, agent.id, TURN_ID), [shellCall]);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test("refetchTurnTimeline does not associate a null hook turn id", async () => {
|
|
115
|
+
const { paseo, requests } = fakePaseo(turnEntries([prompt, shellCall]));
|
|
116
|
+
|
|
117
|
+
assert.deepEqual(await refetchTurnTimeline(paseo, agent.id, null), []);
|
|
118
|
+
assert.deepEqual(requests, []);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test(
|
|
122
|
+
"ingestTurnAfter records tool calls, model and confirmed turn id",
|
|
123
|
+
withStore(async (store) => {
|
|
124
|
+
const { paseo } = fakePaseo(turnEntries([prompt, skillCall, shellCall]), {
|
|
125
|
+
model: "claude-sonnet-4",
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const rows = await ingestTurnAfter(store, paseo, agent, TURN_ID, { homeDir: "/home/tester" });
|
|
129
|
+
|
|
130
|
+
assert.equal(rows, 2);
|
|
131
|
+
const stored = store.select({ agentId: agent.id });
|
|
132
|
+
assert.deepEqual(stored.map((row) => row.callId).sort(), ["call-1", "call-2"]);
|
|
133
|
+
assert.ok(stored.every((row) => row.turnId === TURN_ID));
|
|
134
|
+
assert.equal(store.getAgent(agent.id)?.title, "turn ingest agent");
|
|
135
|
+
const message = store.selectUserMessages({ agentId: agent.id })[0];
|
|
136
|
+
assert.equal(message?.model, "claude-sonnet-4");
|
|
137
|
+
assert.equal(message?.turnId, TURN_ID);
|
|
138
|
+
}),
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
test(
|
|
142
|
+
"ingestTurnAfter keeps terminal calls and their stored classification",
|
|
143
|
+
withStore(async (store) => {
|
|
144
|
+
const first = fakePaseo(turnEntries([prompt, skillCall]));
|
|
145
|
+
await ingestTurnAfter(store, first.paseo, agent, TURN_ID, { homeDir: "/home/tester" });
|
|
146
|
+
const before = store.getRow(agent.id, "call-1");
|
|
147
|
+
assert.equal(before?.category, "skill");
|
|
148
|
+
|
|
149
|
+
const second = fakePaseo(turnEntries([
|
|
150
|
+
prompt,
|
|
151
|
+
toolCall("call-1", "Bash", { type: "shell", command: "git status", exitCode: 0 }),
|
|
152
|
+
]));
|
|
153
|
+
const rows = await ingestTurnAfter(store, second.paseo, agent, TURN_ID, { homeDir: "/home/tester" });
|
|
154
|
+
|
|
155
|
+
assert.equal(rows, 0);
|
|
156
|
+
assert.deepEqual(store.getRow(agent.id, "call-1"), before);
|
|
157
|
+
assert.equal(store.selectUserMessages({ agentId: agent.id }).length, 1);
|
|
158
|
+
}),
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
test(
|
|
162
|
+
"ingestTurnAfter preserves the registry creation time across turns",
|
|
163
|
+
withStore(async (store) => {
|
|
164
|
+
const { paseo } = fakePaseo([]);
|
|
165
|
+
await ingestTurnAfter(store, paseo, agent, TURN_ID);
|
|
166
|
+
const createdAt = store.getAgent(agent.id)?.createdAt;
|
|
167
|
+
assert.ok(createdAt);
|
|
168
|
+
|
|
169
|
+
await ingestTurnAfter(store, paseo, { ...agent, title: "renamed" }, "turn-2");
|
|
170
|
+
|
|
171
|
+
assert.equal(store.getAgent(agent.id)?.createdAt, createdAt);
|
|
172
|
+
assert.equal(store.getAgent(agent.id)?.title, "renamed");
|
|
173
|
+
}),
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
test(
|
|
177
|
+
"ingestTurnAfter records more than 500 entries in one complete turn",
|
|
178
|
+
withStore(async (store) => {
|
|
179
|
+
const calls = Array.from({ length: 600 }, (_entry, index) =>
|
|
180
|
+
toolCall(`long-${index}`, "Bash", { type: "shell", command: "git status", exitCode: 0 }),
|
|
181
|
+
);
|
|
182
|
+
const { paseo, requests } = fakePaseo(turnEntries([prompt, ...calls]));
|
|
183
|
+
const rows = await ingestTurnAfter(store, paseo, agent, TURN_ID, { homeDir: "/home/tester" });
|
|
184
|
+
|
|
185
|
+
assert.equal(rows, 600);
|
|
186
|
+
assert.deepEqual(requests, [{ direction: "tail", limit: 1, wholeTurns: true }]);
|
|
187
|
+
assert.ok(store.getRow(agent.id, "long-0"));
|
|
188
|
+
assert.ok(store.getRow(agent.id, "long-599"));
|
|
189
|
+
assert.equal(store.selectUserMessages({ agentId: agent.id }).length, 1);
|
|
190
|
+
}),
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
test(
|
|
194
|
+
"ingestTurnAfter preserves stored older turns and only adds the matching turn",
|
|
195
|
+
withStore(async (store) => {
|
|
196
|
+
const older = fakePaseo(turnEntries([prompt, skillCall], "older"));
|
|
197
|
+
await ingestTurnAfter(store, older.paseo, agent, "older", { homeDir: "/home/tester" });
|
|
198
|
+
const storedOlder = store.getRow(agent.id, skillCall.callId);
|
|
199
|
+
const nextPrompt: AgentTimelineItem = { type: "user_message", messageId: "m-2", text: "next" };
|
|
200
|
+
const newerPrompt: AgentTimelineItem = { type: "user_message", messageId: "m-3", text: "later" };
|
|
201
|
+
const mixed = fakePaseo([
|
|
202
|
+
...turnEntries([prompt, skillCall], "older"),
|
|
203
|
+
...turnEntries([nextPrompt, shellCall]),
|
|
204
|
+
...turnEntries([newerPrompt, toolCall("future", "Bash", { type: "shell", command: "pwd" })], "newer"),
|
|
205
|
+
]);
|
|
206
|
+
|
|
207
|
+
assert.equal(await ingestTurnAfter(store, mixed.paseo, agent, TURN_ID, { homeDir: "/home/tester" }), 1);
|
|
208
|
+
assert.equal(await ingestTurnAfter(store, mixed.paseo, agent, TURN_ID, { homeDir: "/home/tester" }), 0);
|
|
209
|
+
assert.deepEqual(store.getRow(agent.id, skillCall.callId), storedOlder);
|
|
210
|
+
assert.equal(store.getRow(agent.id, shellCall.callId)?.turnId, TURN_ID);
|
|
211
|
+
assert.equal(store.getRow(agent.id, "future"), null);
|
|
212
|
+
const messageIds = store.selectUserMessages({ agentId: agent.id }).map((row) => row.messageId).sort();
|
|
213
|
+
assert.deepEqual(messageIds, ["m-1", "m-2"]);
|
|
214
|
+
}),
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
test(
|
|
218
|
+
"ingestTurnAfter leaves a replaced or null turn for background backfill",
|
|
219
|
+
withStore(async (store) => {
|
|
220
|
+
const { paseo, requests } = fakePaseo(turnEntries([prompt, shellCall], "newer"));
|
|
221
|
+
|
|
222
|
+
assert.equal(await ingestTurnAfter(store, paseo, agent, TURN_ID), 0);
|
|
223
|
+
assert.equal(await ingestTurnAfter(store, paseo, agent, null), 0);
|
|
224
|
+
assert.equal(requests.length, 1);
|
|
225
|
+
assert.equal(store.count(), 0);
|
|
226
|
+
assert.equal(store.selectUserMessages({ agentId: agent.id }).length, 0);
|
|
227
|
+
}),
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
test(
|
|
231
|
+
"ingestTurnAfter resolves and trims a model from a refreshed snapshot",
|
|
232
|
+
withStore(async (store) => {
|
|
233
|
+
const { paseo } = fakePaseo(turnEntries([prompt]), { refreshedModel: " claude-sonnet-4 " });
|
|
234
|
+
|
|
235
|
+
assert.equal(await ingestTurnAfter(store, paseo, agent, TURN_ID), 0);
|
|
236
|
+
assert.equal(store.selectUserMessages({ agentId: agent.id })[0]?.model, "claude-sonnet-4");
|
|
237
|
+
}),
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
test(
|
|
241
|
+
"ingestTurnAfter does not start after cancellation",
|
|
242
|
+
withStore(async (store) => {
|
|
243
|
+
const controller = new AbortController();
|
|
244
|
+
controller.abort();
|
|
245
|
+
const { paseo, requests } = fakePaseo(turnEntries([prompt]));
|
|
246
|
+
|
|
247
|
+
assert.equal(await ingestTurnAfter(store, paseo, agent, TURN_ID, { signal: controller.signal }), 0);
|
|
248
|
+
assert.deepEqual(requests, []);
|
|
249
|
+
assert.equal(store.getAgent(agent.id), null);
|
|
250
|
+
assert.equal(store.selectUserMessages({ agentId: agent.id }).length, 0);
|
|
251
|
+
}),
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
test(
|
|
255
|
+
"ingestTurnAfter stops before refetch when canceled during model refresh",
|
|
256
|
+
withStore(async (store) => {
|
|
257
|
+
const controller = new AbortController();
|
|
258
|
+
const { paseo, requests } = fakePaseo(turnEntries([prompt]), {
|
|
259
|
+
beforeRefresh: () => controller.abort(),
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
assert.equal(await ingestTurnAfter(store, paseo, agent, TURN_ID, { signal: controller.signal }), 0);
|
|
263
|
+
assert.deepEqual(requests, []);
|
|
264
|
+
assert.equal(store.selectUserMessages({ agentId: agent.id }).length, 0);
|
|
265
|
+
assert.equal(store.count(), 0);
|
|
266
|
+
}),
|
|
267
|
+
);
|
|
268
|
+
|
|
269
|
+
test(
|
|
270
|
+
"ingestTurnAfter does not write when canceled during timeline refetch",
|
|
271
|
+
withStore(async (store) => {
|
|
272
|
+
const controller = new AbortController();
|
|
273
|
+
const { paseo } = fakePaseo(turnEntries([prompt, shellCall]), {
|
|
274
|
+
beforeRefetch: () => controller.abort(),
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
assert.equal(await ingestTurnAfter(store, paseo, agent, TURN_ID, { signal: controller.signal }), 0);
|
|
278
|
+
assert.equal(store.selectUserMessages({ agentId: agent.id }).length, 0);
|
|
279
|
+
assert.equal(store.count(), 0);
|
|
280
|
+
}),
|
|
281
|
+
);
|
|
282
|
+
|
|
283
|
+
test("ingestTurnAfter ignores a late timeline response after SQLite closes", async () => {
|
|
284
|
+
const dir = mkdtempSync(join(tmpdir(), "activity-turn-ingest-closed-"));
|
|
285
|
+
const store = createUsageStore({ dir, driver: "sqlite" });
|
|
286
|
+
const controller = new AbortController();
|
|
287
|
+
let closed = false;
|
|
288
|
+
const { paseo } = fakePaseo(turnEntries([prompt]), {
|
|
289
|
+
beforeRefetch: () => {
|
|
290
|
+
controller.abort();
|
|
291
|
+
store.close();
|
|
292
|
+
closed = true;
|
|
293
|
+
},
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
try {
|
|
297
|
+
assert.equal(store.driver, "sqlite");
|
|
298
|
+
assert.equal(await ingestTurnAfter(store, paseo, agent, TURN_ID, { signal: controller.signal }), 0);
|
|
299
|
+
} finally {
|
|
300
|
+
if (!closed) store.close();
|
|
301
|
+
rmSync(dir, { recursive: true, force: true });
|
|
302
|
+
}
|
|
303
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import type { PluginHookAgent, PluginHookContext } from "@getpaseo/plugin/server";
|
|
3
|
+
import { agentRowFromHook } from "./agents.ts";
|
|
4
|
+
import type { AgentTimelineItem } from "./host-types.ts";
|
|
5
|
+
import { ingestTimeline, ingestUserMessages } from "./ingest.ts";
|
|
6
|
+
import { resolveAgentModel } from "./resolve-model.ts";
|
|
7
|
+
import type { UsageStore } from "./store.ts";
|
|
8
|
+
|
|
9
|
+
type PaseoApi = PluginHookContext["paseo"];
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Read the latest complete turn and keep only entries belonging to the hook's turn.
|
|
13
|
+
*/
|
|
14
|
+
export async function refetchTurnTimeline(
|
|
15
|
+
paseo: PaseoApi,
|
|
16
|
+
agentId: string,
|
|
17
|
+
turnId: string | null,
|
|
18
|
+
): Promise<AgentTimelineItem[]> {
|
|
19
|
+
if (turnId === null) return [];
|
|
20
|
+
const page = await paseo.agents.ref(agentId).timeline.refetch({
|
|
21
|
+
direction: "tail",
|
|
22
|
+
limit: 1,
|
|
23
|
+
wholeTurns: true,
|
|
24
|
+
});
|
|
25
|
+
if (page.error) throw new Error(page.error);
|
|
26
|
+
return page.entries.filter((entry) => entry.turnId === turnId).map(({ item }) => item);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface IngestTurnAfterOptions {
|
|
30
|
+
homeDir?: string;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Ingest one finished turn from a freshly read complete turn.
|
|
36
|
+
*
|
|
37
|
+
* Returns the number of tool-call rows upserted. Calls already stored in a
|
|
38
|
+
* terminal status cannot change from a snapshot, so they are skipped.
|
|
39
|
+
*/
|
|
40
|
+
export async function ingestTurnAfter(
|
|
41
|
+
store: UsageStore,
|
|
42
|
+
paseo: PaseoApi,
|
|
43
|
+
agent: PluginHookAgent,
|
|
44
|
+
turnId: string | null,
|
|
45
|
+
options: IngestTurnAfterOptions = {},
|
|
46
|
+
): Promise<number> {
|
|
47
|
+
if (options.signal?.aborted) return 0;
|
|
48
|
+
const existing = store.getAgent(agent.id);
|
|
49
|
+
store.upsertAgents([
|
|
50
|
+
agentRowFromHook(agent, {
|
|
51
|
+
createdAt: existing?.createdAt,
|
|
52
|
+
archivedAt: existing?.archivedAt,
|
|
53
|
+
}),
|
|
54
|
+
]);
|
|
55
|
+
if (turnId === null) return 0;
|
|
56
|
+
|
|
57
|
+
const model = await resolveAgentModel(paseo, agent.id);
|
|
58
|
+
if (options.signal?.aborted) return 0;
|
|
59
|
+
const timeline = await refetchTurnTimeline(paseo, agent.id, turnId);
|
|
60
|
+
if (options.signal?.aborted) return 0;
|
|
61
|
+
if (timeline.length === 0) return 0;
|
|
62
|
+
store.upsertUserMessages(ingestUserMessages(timeline, agent, { model, turnId }));
|
|
63
|
+
store.pruneReplayDuplicateMessages(agent.id);
|
|
64
|
+
|
|
65
|
+
const settled = store.terminalCallIds(agent.id);
|
|
66
|
+
const pending = timeline.filter(
|
|
67
|
+
(item) => item.type !== "tool_call" || !settled.has(item.callId),
|
|
68
|
+
);
|
|
69
|
+
const rows = ingestTimeline(pending, agent, turnId, {
|
|
70
|
+
homeDir: options.homeDir ?? homedir(),
|
|
71
|
+
});
|
|
72
|
+
if (rows.length === 0) return 0;
|
|
73
|
+
store.upsertMany(rows);
|
|
74
|
+
return rows.length;
|
|
75
|
+
}
|
package/shared/insights.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type InsightSummary = {
|
|
|
18
18
|
chatAgents?: number;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
/** Shared cap for
|
|
21
|
+
/** Shared cap for the Workspace Activity Skills / MCP rankings. */
|
|
22
22
|
export const ACTIVITY_LIST_LIMIT = 8;
|
|
23
23
|
|
|
24
24
|
function formatDayLabel(dateKey: string, locale: string): string {
|