Merge branch 'cw/radar' into cw-merge-1772825408137

This commit is contained in:
Lukas May
2026-03-06 20:30:08 +01:00
22 changed files with 3186 additions and 5 deletions

View File

@@ -88,6 +88,24 @@ class InMemoryConversationRepository implements ConversationRepository {
return updated;
}
async countByFromAgentIds(agentIds: string[]): Promise<{ agentId: string; count: number }[]> {
if (agentIds.length === 0) return [];
const counts = new Map<string, number>();
for (const conv of this.store.values()) {
if (agentIds.includes(conv.fromAgentId)) {
counts.set(conv.fromAgentId, (counts.get(conv.fromAgentId) ?? 0) + 1);
}
}
return [...counts.entries()].map(([agentId, count]) => ({ agentId, count }));
}
async findByFromAgentId(agentId: string): Promise<Conversation[]> {
return [...this.store.values()]
.filter((c) => c.fromAgentId === agentId)
.sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime())
.slice(0, 200);
}
/** Test helper — return all conversations */
getAll(): Conversation[] {
return [...this.store.values()];