MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / groupThreads

Function groupThreads

ui/src/live/inbox-threads.ts:32–50  ·  view source on GitHub ↗
(entries: readonly InboxEntry[])

Source from the content-addressed store, hash-verified

30 * display label stay distinct threads.
31 */
32export function groupThreads(entries: readonly InboxEntry[]): InboxThread[] {
33 const byWs = new Map<string, InboxEntry[]>()
34 for (const e of entries) {
35 const arr = byWs.get(e.workspaceId)
36 if (arr) arr.push(e)
37 else byWs.set(e.workspaceId, [e])
38 }
39 const threads: InboxThread[] = []
40 for (const [workspaceId, es] of byWs) {
41 threads.push({
42 workspaceId,
43 workspaceLabel: es[0]!.workspaceLabel,
44 entries: es,
45 latestTs: es[0]!.ts,
46 })
47 }
48 threads.sort((a, b) => b.latestTs - a.latestTs)
49 return threads
50}
51
52/**
53 * Second-line preview text for a sidebar row — the latest push's comment

Callers 1

InboxSidebarFunction · 0.90

Calls 3

getMethod · 0.65
pushMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected