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

Function partToContentChunks

packages/opencode/src/acp/content.ts:123–151  ·  view source on GitHub ↗
(part: ReplayPart)

Source from the content-addressed store, hash-verified

121}
122
123export function partToContentChunks(part: ReplayPart): ContentChunk[] {
124 switch (part.type) {
125 case "text":
126 if (!part.text) return []
127 return [
128 {
129 content: {
130 type: "text",
131 text: part.text,
132 ...partAudience(part),
133 },
134 },
135 ]
136
137 case "file":
138 return filePartToContentChunks(part)
139
140 case "reasoning":
141 if (!part.text) return []
142 return [
143 {
144 content: {
145 type: "text",
146 text: part.text,
147 },
148 },
149 ]
150 }
151}
152
153function resourceLinkToPart(link: ResourceLink): PromptPart {
154 const parsed = uriToFilePart(link.uri, link.mimeType ?? "text/plain", link.name)

Callers

nothing calls this directly

Calls 2

partAudienceFunction · 0.85
filePartToContentChunksFunction · 0.85

Tested by

no test coverage detected