MCPcopy Create free account
hub / github.com/anomalyco/opencode / visible

Function visible

packages/opencode/test/cli/run/subagent-data.test.ts:15–40  ·  view source on GitHub ↗
(commits: Array<Parameters<typeof entryBody>[0]>)

Source from the content-addressed store, hash-verified

13type ChildMessage = Parameters<typeof bootstrapSubagentCalls>[0]["messages"][number]
14
15function visible(commits: Array<Parameters<typeof entryBody>[0]>) {
16 return commits.flatMap((item) => {
17 const body = entryBody(item)
18 if (body.type === "none") {
19 return []
20 }
21
22 if (body.type === "structured") {
23 if (body.snapshot.kind === "code" || body.snapshot.kind === "task") {
24 return [body.snapshot.title]
25 }
26
27 if (body.snapshot.kind === "diff") {
28 return body.snapshot.items.map((item) => item.title)
29 }
30
31 if (body.snapshot.kind === "todo") {
32 return ["# Todos"]
33 }
34
35 return ["# Questions"]
36 }
37
38 return [body.content]
39 })
40}
41
42function reduce(data: ReturnType<typeof createSubagentData>, event: unknown) {
43 return reduceSubagentData({

Callers 4

createPromptStateFunction · 0.50
refreshFunction · 0.50
submitPromptFunction · 0.50

Calls 1

entryBodyFunction · 0.90

Tested by

no test coverage detected