Skip to content

Commit a8def7f

Browse files
Sync public snapshot from freebuff-private
Source: CodebuffAI/freebuff-private@3af538b73d5f443285ca98f0c638a5506ed377f9
1 parent ab19b75 commit a8def7f

2 files changed

Lines changed: 3 additions & 49 deletions

File tree

bun.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/src/utils/message-tree-utils.ts

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -19,49 +19,3 @@ export function buildMessageTree(messages: ChatMessage[]): {
1919

2020
return { tree: messageTree, topLevelMessages }
2121
}
22-
23-
export function getDescendantIds(
24-
agentId: string,
25-
tree: Map<string, ChatMessage[]>,
26-
): string[] {
27-
const children = tree.get(agentId) ?? []
28-
const descendantIds: string[] = []
29-
30-
for (const child of children) {
31-
if (child.variant === 'agent') {
32-
descendantIds.push(child.id)
33-
descendantIds.push(...getDescendantIds(child.id, tree))
34-
}
35-
}
36-
37-
return descendantIds
38-
}
39-
40-
export function getAncestorIds(
41-
agentId: string,
42-
messages: ChatMessage[],
43-
): string[] {
44-
const agent = messages.find((m) => m.id === agentId)
45-
if (!agent || !agent.parentId) return []
46-
47-
const parent = messages.find((m) => m.id === agent.parentId)
48-
if (!parent || parent.variant !== 'agent') return []
49-
50-
return [parent.id, ...getAncestorIds(parent.id, messages)]
51-
}
52-
53-
export function isAgentVisible(
54-
agentId: string,
55-
messages: ChatMessage[],
56-
collapsedAgents: Set<string>,
57-
): boolean {
58-
const agent = messages.find((m) => m.id === agentId)
59-
if (!agent || agent.variant !== 'agent') return false
60-
61-
const parent = messages.find((m) => m.id === agent.parentId)
62-
if (!parent || parent.variant !== 'agent') return true
63-
64-
if (collapsedAgents.has(parent.id)) return false
65-
66-
return isAgentVisible(parent.id, messages, collapsedAgents)
67-
}

0 commit comments

Comments
 (0)